gpt4 book ai didi

python - 在pycharm中调试python代码

转载 作者:太空狗 更新时间:2023-10-29 17:20:56 26 4
gpt4 key购买 nike

这个问题类似于this一。我正在尝试调试 pyethapp使用以下配置:

debug_app

入口点位于 app.py 中。代码在未调试时运行良好,但一旦我启动调试器,就会抛出以下异常:

Failed to import scrypt. This is not a fatal error but does
mean that you cannot create or decrypt privkey jsons that use
scrypt

/usr/local/lib/python2.7/dist-packages/cffi/model.py:526: UserWarning: 'point_conversion_form_t' has no values explicitly defined; next version will refuse to guess which integer type it is meant to be (unsigned/signed, int/long)
% self._get_c_name())
Traceback (most recent call last):
File "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/pydevd.py", line 1530, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/pydevd.py", line 937, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "app.py", line 27, in <module>
from console_service import Console
File "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/_pydev_bundle/pydev_monkey_qt.py", line 71, in patched_import
return original_import(name, *args, **kwargs)
File "console_service.py", line 38, in <module>
@inputhook_manager.register('gevent')
AttributeError: 'InputHookManager' object has no attribute 'register'

建议的解决方案here (重新安装ipython)没有解决问题(只在调试时出现;客户端单独运行时有效)。

编辑:

输出中的命令行:

/usr/bin/python2.7 /home/user/Utils/pycharm-community-2016.1/helpers/pydev/pydevd.py --cmd-line --multiproc --qt-support --client 127.0.0.1 --port 59087 --file app.py --profile testnet --data-dir testnetState/ run
warning: Debugger speedups using cython not found. Run '"/usr/bin/python2.7" "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/setup_cython.py" build_ext --inplace' to build.
pydev debugger: process 20493 is connecting

Connected to pydev debugger (build 145.260)

Failed to import scrypt. This is not a fatal error but does
mean that you cannot create or decrypt privkey jsons that use
scrypt

/usr/local/lib/python2.7/dist-packages/cffi/model.py:526: UserWarning: 'point_conversion_form_t' has no values explicitly defined; next version will refuse to guess which integer type it is meant to be (unsigned/signed, int/long)
% self._get_c_name())
Traceback (most recent call last):
File "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/pydevd.py", line 1530, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/pydevd.py", line 937, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "app.py", line 27, in <module>
from console_service import Console
File "/home/user/Utils/pycharm-community-2016.1/helpers/pydev/_pydev_bundle/pydev_monkey_qt.py", line 71, in patched_import
return original_import(name, *args, **kwargs)
File "console_service.py", line 38, in <module>
@inputhook_manager.register('gevent')
AttributeError: 'InputHookManager' object has no attribute 'register'

最佳答案

已知如果您使用旧版本的 IPython(其中确实尚未实现 register 方法),就会发生此错误。由于您可能使用 OSX,其中包含默认的 Python 安装,因此您的环境中可能存在一些冲突的 Ipython 副本,常规和调试配置调用了不同版本的 Ipython 副本?

这个问题可能通过将项目移动到您的根包无法干扰的虚拟环境来解决。

关于python - 在pycharm中调试python代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37527761/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com