Error when debugging with breakpoints

I can run my Django application in normal run mode as well as in debug mode so loang as there are no breakpoints. When I create a breakpoint, however, the process produces the following error (process does not exit):

Connected to pydev debugger (build 192.6817.19)
pydev debugger: process 10708 is connecting

Unhandled exception in thread started by <_pydev_bundle.pydev_monkey._NewThreadStartupWithTrace object at 0x0000011C7F8F8BE0>
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2018.3.1\helpers\pydev\_pydevd_bundle\", line 332, in get_current_thread_id
AttributeError: '_DummyThread' object has no attribute '__pydevd_id__'

During handling of the above exception, another exception occurred:

SystemError: ..\Objects\codeobject.c:851: bad argument to internal function

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2018.3.1\helpers\pydev\_pydev_bundle\", line 736, in __call__
File "C:\Program Files\JetBrains\PyCharm 2018.3.1\helpers\pydev\_pydevd_bundle\", line 339, in get_current_thread_id
File "C:\Program Files\JetBrains\PyCharm 2018.3.1\helpers\pydev\_pydevd_bundle\", line 306, in _get_or_compute_thread_id_with_lock
SystemError: <built-in method __enter__ of _thread.lock object at 0x0000011C7C6C54B8> returned a result with an error set

Comment actions Permalink

Please update to the latest PyCharm version and check if the issue remains.

Comment actions Permalink

Hey Sergey - I have this as well, and have had for a while.  Problem persists in 2019.2.3.  From advice from another thread on this forum, I currently have the following environment variables set:



For me, this only happens in debugging and stops the debugger when it occurs.

Here's the full stack trace.

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/django/core/management/", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/dist-packages/django/core/management/commands/", line 60, in execute
super().execute(*args, **options)
File "/usr/local/lib/python3.6/dist-packages/django/core/management/", line 364, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.6/dist-packages/django/core/management/commands/", line 95, in handle**options)
File "/usr/local/lib/python3.6/dist-packages/django/core/management/commands/", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 598, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 583, in start_django
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 301, in run
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 307, in run_loop
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 347, in tick
for filepath, mtime in self.snapshot_files():
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 363, in snapshot_files
for file in self.watched_files():
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 262, in watched_files
yield from iter_all_python_module_files()
File "/usr/local/lib/python3.6/dist-packages/django/utils/", line 102, in iter_all_python_module_files
modules = tuple(m[1] for m in modules_view if not isinstance(m[1], weakref.ProxyTypes))
SystemError: ../Objects/tupleobject.c:851: bad argument to internal function

Comment actions Permalink


May I kindly ask you to file an issue to our bug tracker and provide some code and steps for reproducing?


Please sign in to leave a comment.