Problem with PyCharm debugger Python 2.7 Django 1.8

Answered

I updated my PyCharm and after that the debugger is not working in my Django 1.8 on python 2.7 project.

from the traceback in the console I saw it has something to do with the auto-reload in Django-utils and if I disable that in the settings the debugger works.

Here is the full traceback. The attribute error has to do with ctypes so it might somehow be related to this issue?

Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1434, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Users/matthijs/Documents/development/projectname/manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 49, in execute
super(Command, self).execute(*args, **options)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 88, in handle
self.run(**options)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 97, in run
autoreload.main(self.inner_run, None, options)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/utils/autoreload.py", line 336, in main
reloader(wrapped_main_func, args, kwargs)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/utils/autoreload.py", line 307, in python_reloader
exit_code = restart_with_reloader()
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/site-packages/django/utils/autoreload.py", line 293, in restart_with_reloader
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 496, in new_spawnve
return getattr(os, original_name)(mode, path, args, env)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/os.py", line 575, in spawnve
return _spawnvef(mode, file, args, env, execve)
File "/Users/matthijs/Documents/development/pythonenvs/projectname/lib/python2.7/os.py", line 533, in _spawnvef
pid = fork()
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 598, in new_fork
_on_forked_process()
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_monkey.py", line 73, in _on_forked_process
pydevd.settrace_forked()
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1867, in settrace_forked
patch_multiprocessing=True,
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1631, in settrace
stop_at_frame,
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1711, in _locked_settrace
debugger.enable_tracing(apply_to_all_threads=True)
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 492, in enable_tracing
pydevd_tracing.set_trace_to_threads(thread_trace_func)
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd_tracing.py", line 241, in set_trace_to_threads
result = lib.AttachDebuggerTracing(
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 379, in __getattr__
func = self.__getitem__(name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 384, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x7f82bcb371e0, AttachDebuggerTracing): symbol not found
4
2 comments

The problem is specific to 2019.3 and being tracked in https://youtrack.jetbrains.com/issue/PY-39242, please upvote and feel free to leave comments.

The fix should be included in the next minor update.

Please see this comment https://youtrack.jetbrains.com/issue/PY-39242#focus=streamItem-27-3845736.0-0 for possible workarounds.

0
Avatar
Permanently deleted user

Great! Thank you

0

Please sign in to leave a comment.