Advertisement
AceScottie

boot_common.py

Nov 23rd, 2018
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1.         _file = None
  2.         _error = None
  3.         if not os.path.exists(os.path.dirname(str(os.environ['USERPROFILE'])+"\\Documents\\")):
  4.             os.makedirs(str(os.environ['USERPROFILE'])+"\\Documents\\Encryptor\\")
  5.         def write(self, text, alert=sys._MessageBox, fname=str(os.environ['USERPROFILE'])+"\\Documents\\app.log"):
  6.             if self._file is None and self._error is None:
  7.                 try:
  8.                     self._file = open(fname, 'a')
  9.                 except Exception, details:
  10.                     self._error = details
  11.                     import atexit
  12.                     atexit.register(alert, 0,
  13.                                     "The logfile '%s' could not be opened:\n %s" % \
  14.                                     (fname, details),
  15.                                     "Errors occurred")
  16.                 else:
  17.                     pass
  18.                     #import atexit
  19.                     #atexit.register(alert, 0,
  20.                      #               "See the logfile '%s' for details" % fname,
  21.                      #               "Errors occurred")
  22.             if self._file is not None:
  23.                 self._file.write(text)
  24.                 self._file.flush()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement