Hello,
I have a problem with exception handling. The server.log is full of the "Message During handling of the above exception, another exception occurred".
The error does not occur locally but only pythonanywhere. I suspect it is somehow in the logging.
This is configured like this:
__init__.py
logging.basicConfig(filename=Config.LOG_FILE, filemode='a', format='%(asctime)s,%(msecs)03d %(levelname)s %(funcName)s %(message)s ', datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO)
Config.py
this_folder = str(Path(__file__).parent.resolve())
LOG_FILE = this_folder + '/logger/log.log'
Here is an excerpt from the log file:
2023-06-13 11:00:55 #012During handling of the above exception, another exception occurred:
2023-06-13 11:00:55 Traceback (most recent call last):
2023-06-13 11:00:55 File "/usr/local/lib/python3.10/logging/__init__.py", line 1104, in emit#012 self.flush()
2023-06-13 11:00:55 File "/usr/local/lib/python3.10/logging/__init__.py", line 1084, in flush#012 self.stream.flush()
2023-06-13 11:00:55 OSError: [Errno 116] Stale file handle
2023-06-13 11:00:55 #012During handling of the above exception, another exception occurred:
2023-06-13 11:00:55 Traceback (most recent call last):
2023-06-13 11:00:55 File "/usr/local/lib/python3.10/logging/__init__.py", line 1104, in emit#012 self.flush()
2023-06-13 11:00:55 File "/usr/local/lib/python3.10/logging/__init__.py", line 1084, in flush#012 self.stream.flush()
2023-06-13 11:00:55 OSError: [Errno 116] Stale file handle
2023-06-13 11:00:55 #012During handling of the above exception, another exception occurred:
2023-06-13 11:00:55 Traceback (most recent call last):
2023-06-13 11:00:55 File "/usr/local/lib/python3.10/logging/__init__.py", line 1104, in emit#012 self.flush()
2023-06-13 11:00:55 File "/usr/local/lib/python3.10/logging/__init__.py", line 1084, in flush#012 self.stream.flush()
2023-06-13 11:00:55 OSError: [Errno 116] Stale file handle
Does anyone have an idea or approach for me?
thanks and greetings
Tom