Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _file = None
- _error = None
- if not os.path.exists(os.path.dirname(str(os.environ['USERPROFILE'])+"\\Documents\\")):
- os.makedirs(str(os.environ['USERPROFILE'])+"\\Documents\\Encryptor\\")
- def write(self, text, alert=sys._MessageBox, fname=str(os.environ['USERPROFILE'])+"\\Documents\\app.log"):
- if self._file is None and self._error is None:
- try:
- self._file = open(fname, 'a')
- except Exception, details:
- self._error = details
- import atexit
- atexit.register(alert, 0,
- "The logfile '%s' could not be opened:\n %s" % \
- (fname, details),
- "Errors occurred")
- else:
- pass
- #import atexit
- #atexit.register(alert, 0,
- # "See the logfile '%s' for details" % fname,
- # "Errors occurred")
- if self._file is not None:
- self._file.write(text)
- self._file.flush()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement