From 1961e9f73924c2b27625bdb31545e93ab5e49f89 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Fri, 5 Feb 2016 11:16:14 +0100
Subject: [PATCH] Fix bugs in twt integration.

---
 plomlombot.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plomlombot.py b/plomlombot.py
index c6a3777..786b072 100755
--- a/plomlombot.py
+++ b/plomlombot.py
@@ -247,13 +247,13 @@ def handle_command(command, argument, notice, target, session):
         def try_open(mode):
             try:
                 twtfile = open(session.twtfile, "w")
-            except PermissionError, FileNotFoundError:
-                notice("CAN'T ACCESS OR CREATE TWT FILE.")
+            except (PermissionError, FileNotFoundError) as err:
+                notice("CAN'T ACCESS OR CREATE TWT FILE: " + str(err))
                 return None
             return twtfile
 
         from datetime import datetime
-        if not os.access(path, os.F_OK):
+        if not os.access(session.twtfile, os.F_OK):
             twtfile = try_open("w")
             if None == twtfile:
                 return
-- 
2.30.2