I’m using pymongo for building a RAG application. Until now I have only defined a couple of functions in my code and on running my .py file from the VS Code terminal, I’m getting a ‘Exception in thread pymongo_server_monitor_thread:’. The full traceback is given below:
python helper.py
Exception in thread pymongo_server_monitor_thread:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 989, in run
self._target(*self._args, **self._kwargs)
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/periodic_executor.py", line 133, in _run
if not self._target():
^^^^^^^^^^^^^^
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 61, in target
monitor._run() # type:ignore[attr-defined]
^^^^^^^^^^^^^^
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 213, in _run
self._start_rtt_monitor()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 167, in _start_rtt_monitor
self._rtt_monitor.open()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 87, in open
self._executor.open()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/periodic_executor.py", line 95, in open
thread.start()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 971, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
Exception in thread pymongo_server_monitor_thread:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
Exception in thread pymongo_server_monitor_thread:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 989, in run
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 989, in run
self._target(*self._args, **self._kwargs)
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/periodic_executor.py", line 133, in _run
if not self._target():
self._target(*self._args, **self._kwargs)
^^^^^^^^^^^^^^
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/periodic_executor.py", line 133, in _run
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 61, in target
if not self._target():
^^^^^^^^^^^^^^
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 61, in target
monitor._run() # type:ignore[attr-defined]
^^^^^^^^^^^^^^
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 213, in _run
monitor._run() # type:ignore[attr-defined]
^^^^^^^^^^^^^^
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 213, in _run
self._start_rtt_monitor()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 167, in _start_rtt_monitor
self._rtt_monitor.open()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 87, in open
self._start_rtt_monitor()
self._executor.open()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 167, in _start_rtt_monitor
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/periodic_executor.py", line 95, in open
self._rtt_monitor.open()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/monitor.py", line 87, in open
thread.start()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 971, in start
self._executor.open()
File "/Users/zuhaib/Documents/ast-bot-mongoDB/venv/lib/python3.12/site-packages/pymongo/periodic_executor.py", line 95, in open
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
thread.start()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 971, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown