Python Logging Error -
so i'm using python logging module first time, , i'm receiving error cannot find information on.
at start of file, have following:
logging.basicconfig(level=logging.info, filename='logs', filemode='a+', format='[%(asctime)-15s] %(levelname)-8s %(message)s')
the line that's throwing error:
logging.info(f'downloading: {file_name}\t{local_file_path}\t{os.path.abspath(local_file_path)}') --- logging error --- traceback (most recent call last): file "c:\python36\lib\logging\__init__.py", line 996, in emit self.flush() file "c:\python36\lib\logging\__init__.py", line 976, in flush self.stream.flush() oserror: [errno 22] invalid argument call stack: file "main.py", line 81, in <module> main() file "c:\python36\lib\site-packages\click\core.py", line 722, in __call__ return self.main(*args, **kwargs) file "c:\python36\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) file "c:\python36\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) file "c:\python36\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) file "main.py", line 32, in main work_tv(ftp, ext) file "main.py", line 76, in work_tv logging.info(f'downloading: {file_name}\t{local_file_path}\t{os.path.abspath(local_file_path)}') message: 'downloading: preacher s02e13\t./preacher/season 2/preacher s02e13.mkv\tz:\\tv\\preacher\\season 2\\preacher s02e13.mkv' arguments: ()
i don't understand error. first 8 times ran without problem. last two, has thrown identical error. can please explain me.
the fact failed on self.stream.flush()
implies file being written (presumably logs
) has been closed or not writable other reason.
update: if need deal this, subclass handler , override emit()
method need recover error.
Comments
Post a Comment