PYTHON Pycharm 递归超出问题 pydevd frame eval.pydevd frame evaluator.get_bytecode_while_frame_eval

2019/7/24 16:31:14 人评论 次浏览 分类:python

More on

Stack Overflow [ 镜像 ]
Seems really strange… I need some more info to better diagnose the issue:
Open \plugins\org.python.pydev.debug\pysrc\pydevd_constants.py and change
DEBUG_TRACE_LEVEL = 3
DEBUG_TRACE_BREAKPOINTS = 3
run your use-case with the problem and add the output to your question…
Also, it could be that for some reason the debugging facility is reset in some library you use or in your code, so, do the following: in the same place that you’d put the breakpoint do:
import sys
print ‘current trace function’, sys.gettrace()
(note: when running in the debugger, it’d be expected that the trace function is something as: <bound method PyDB.trace_dispatch of <main.PyDB instance at 0x01D44878>> )
Also, please post which Python version you’re using.
Answer part 2:
The fact that sys.gettrace() returns None is probably the real issue… I know some external libraries which mess with it (i.e.:DecoratorTools – read: http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html) and have even seen Python bugs and compiled extensions break it…
Still, the most common reason it breaks is probably because Python will silently disable the tracing (and thus the debugger) when a recursion throws a stack overflow error (i.e.: RuntimeError: maximum recursion depth exceeded).
You can probably put a breakpoint in the very beginning of your program and step in the debugger until it stops working.
Or maybe simpler is the following: Add the code below to the very beginning of your program and see how far it goes with the printing… The last thing printed is the code just before it broke (so, you could put a breakpoint at the last line printed knowing it should be the last line where it’d work) – note that if it’s a large program, printing may take a long time – it may even be faster printing to a file instead of a console (such as cmd, bash or eclipse) and later opening that file (just redirect the print from the example to a file).
import sys

def trace_func(frame, event, arg):
print 'Context: ', frame.f_code.co_name, ‘\tFile:’, frame.f_code.co_filename, ‘\tLine:’, frame.f_lineno, ‘\tEvent:’, event
return trace_func

sys.settrace(trace_func)
If you still can’t figure it out, please post more information on the obtained results…
Note: a workaround until you don’t find the actual place is using:
import pydevd;pydevd.settrace()
on the place where you’d put the breakpoint – that way you’d have a breakpoint in code which should definitely work, as it’ll force setting the tracing facility at that point (it’s very similar to the remote debugging: http://pydev.org/manual_adv_remote_debugger.html except that as the debugger was already previously connected, you don’t really have to start the remote debugger, just do the settrace to emulate a breakpoint)

在这里插入图片描述
解决办法是设置中的gevent设置,要记得clear caches

相关资讯

    暂无相关的资讯...

python

共有访客发表了评论 网友评论

验证码: 看不清楚?
    -->