Pycharm 调试器不会在断点处停止 [英] Pycharm debugger does not stop on breakpoints
问题描述
我有一个要调试的 Flask 项目(直到几个小时前它都可以正常工作) - 当我调试项目时,我看到以下内容:
I have a flask project I am trying to debug (this was working absolutely ok till few hours ago) - When I debug the project, I see the following :
Connected to pydev debugger (build 135.1057)
/Users/vantani/cp/bin/python /Applications/PyCharm.app/helpers/pydev/pydevd.py --multiproc --save-
signatures --client 127.0.0.1 --port 49223 --file /Users/vantani/cp/unnamed/manage.py server
pydev debugger: process 484 is connecting
/Users/vantani/cp/lib/python2.7/site-packages/flask_cache/__init__.py:152: UserWarning: Flask-
Cache: CACHE_TYPE is set to null, caching is effectively disabled.
warnings.warn("Flask-Cache: CACHE_TYPE is set to null, "
* Running on http://127.0.0.1:5000/
* Restarting with reloader
pydev debugger: process 498 is connecting
正如我所说,此设置运行良好.现在,调试器不会在断点处停止并且调试器窗口是空的.我看到 PyDev 创建了两个进程,我想这是导致此问题的原因.我已经重新启动了我的机器,但只有一个 pycharm 进程在运行.
As I said this setup was working fine. Now, the debugger does not stop at the breakpoint and the debugger window is empty. I see that there are two processes created by PyDev and I guess that is causing this issue. I have restarted my machine and there is only one pycharm process running.
推荐答案
有时这可能是由于其他模块使用相同的跟踪 API (sys.settrace
) 作为调试器,例如Coverage.py
.解决方案是转到您的 Rub/Debug Configurations 并将 --no-cov
标志添加到 Additional Arguments.
Sometimes this might be caused by the fact that some other module is using the same tracing api (sys.settrace
) as debugger, for instance Coverage.py
. The solution would be to go to your Rub/Debug Configurations and add --no-cov
flag to the Additional Arguments.
或者,您可能希望删除 pytest 设置(即 pytest.ini
)中的所有 --cov
或使用 --no-cov运行测试代码>标志,即
Alternatively you might want to delete all --cov
in pytest settings (i.e. pytest.ini
) or run tests with --no-cov
flag, i.e.
pytest test.py --no-cov
这也可能是由错误的文件名引起的,例如您的文件/目录中有特殊字符或空格.尝试删除它们或更改为例如下划线 (_
).
It might be also caused by a bad filename, e.g. your file/directory has special characters or spaces in it. Try removing them or changing to e.g. underscore (_
).
这篇关于Pycharm 调试器不会在断点处停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!