I'm having this weird error at the end of a script that can't find out why it happens: --- Logging error --- Exception ignored in: <function _ConnectionRecord.checkout.<locals>.<lambda> at 0x000002346C1A7380> Traceback (most recent call last): File "...\Lib\site-packages\sqlalchemy\pool\base.py", line 729, in <lambda> File "...\Lib\site-packages\sqlalchemy\pool\base.py", line 1008, in _finalize_fairy File "logging\__init__.py", line 1518, in error File "logging\__init__.py", line 1634, in _log File "logging\__init__.py", line 1644, in handle File "logging\__init__.py", line 1714, in callHandlers File "logging\__init__.py", line 978, in handle File "logging\__init__.py", line 1118, in emit File "logging\__init__.py", line 1032, in handleError File "traceback.py", line 124, in print_exception File "traceback.py", line 747, in __init__ File "traceback.py", line 692, in __init__ File "traceback.py", line 436, in _extract_from_extended_frame_gen File "traceback.py", line 321, in line File "linecache.py", line 30, in getline File "linecache.py", line 46, in getlines File "linecache.py", line 122, in updatecache TypeError: 'NoneType' object is not iterable where base.py:1008 looks like this: except BaseException as e: pool.logger.error("Exception during reset or similar", exc_info=True) # line 1008 and linecache.py:122 looks like this: for dirname in sys.path: ... However, I only get this error on a customer's server, so I can't reproduce it locally. I used a create_engine(), engine.connect() to create a Connection, connection.close() to close the connection, etc. So I am not even sure why SQL would still be doing stuff after the script is finished, but the weirdest part is that sys.path seems to be None already when this happens. Any idea why this could be happening and to avoid that error message? Continue reading...