+ def twt():
+ def try_open(mode):
+ try:
+ twtfile = open(session.twtfile, "w")
+ except PermissionError, FileNotFoundError:
+ notice("CAN'T ACCESS OR CREATE TWT FILE.")
+ return None
+ return twtfile
+
+ from datetime import datetime
+ if not os.access(path, os.F_OK):
+ twtfile = try_open("w")
+ if None == twtfile:
+ return
+ twtfile.close()
+ twtfile = try_open("a")
+ if None == twtfile:
+ return
+ twtfile.write(datetime.utcnow().isoformat() + "\t" + argument + "\n")
+ twtfile.close()
+ notice("WROTE TWT.")
+