Unable to Debugg

Answered

New to python programming and when I try debugging it stops within a built in function. I get:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 1664, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 1044, in run
self.prepare_to_run()
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 963, in prepare_to_run
pydevd_tracing.SetTrace(self.trace_dispatch, self.frame_eval_func, self.dummy_trace_dispatch)
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\_pydevd_bundle\pydevd_tracing.py", line 73, in SetTrace
frame_eval_func()
File "_pydevd_frame_eval\pydevd_frame_evaluator_win32_37_64.pyx", line 155, in _pydevd_frame_eval.pydevd_frame_evaluator_win32_37_64.frame_eval_func
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\_pydevd_frame_eval\pydevd_frame_tracing.py", line 14, in set_trace_func
self.dummy_trace_func = trace_func
UnboundLocalError: local variable 'trace_func' referenced before assignment

 

I can't change this file. 

6 comments
Comment actions Permalink

Hi Cat044,
Thank you for contacting PyCharm support.

Unfortunately it's a known bug: https://youtrack.jetbrains.com/issue/PY-30852 in Pycharm issue tracker. Please follow it for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack. As a workaround please add the environment variable PYDEVD_USE_FRAME_EVAL=NO to your Debug configuration (Run| Edit Configurations...).

Kind regards,
Sergey
https://www.jetbrains.com
The Drive to Develop

0
Comment actions Permalink

Hello Mr. Karpov,

 

I went to debug -> configure -> under python -> under my file environment variable-> enter what you said. Now when I run I get a new error...:

Traceback (most recent call last):

File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 1664, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 1044, in run
self.prepare_to_run()
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 967, in prepare_to_run
PyDBCommandThread(self).start()
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\pydevd.py", line 93, in __init__
def __init__(self, py_db):
File "C:\Program Files\JetBrains\PyCharm 2018.1.4\helpers\pydev\_pydevd_bundle\pydevd_trace_dispatch.py", line 55, in trace_dispatch
return _trace_dispatch(py_db, frame, event, arg)
File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 939, in _pydevd_bundle.pydevd_cython_win32_37_64.trace_dispatch
AttributeError: '_MainThread' object has no attribute 'pydev_do_not_trace'

0
Comment actions Permalink

Thank you for the update.

Please provide a screenshot of your Run/Debug Configuration window with environment variable which you have previously added.

Kind regards,

Sergey

https://www.jetbrains.com

The Drive to Develop

0
Comment actions Permalink
Thank you for the update. Well that's pretty odd. Please try also adding PYDEVD_USE_CYTHON=NO. Please let me know the result. Looking forward to your reply. Kind regards, Sergey https://www.jetbrains.com The Drive to Develop
0
Comment actions Permalink

Sorry for the lat response, but it would appear that your last suggestion has mad a work around for the issue. Thank you so much!!!

0

Please sign in to leave a comment.