2016-05-30 123 views
14

這個問題類似於this之一。我試圖調試pyethapp 具有以下配置:在pycharm中調試python代碼

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' 
+0

您確定您的調試和非調試配置實際上使用相同版本的python? – pvg

+0

是的,我使用2.7.9進行調試並獨立運行腳本。 – Sebi

+0

我的意思是安裝,真的,而不是版本。也許檢查'顯示命令行'複選框。 – pvg

回答

1

這個錯誤是已知如果你使用IPython中的舊版本(其中的確方法register尚未實施)的情況發生。您大概會使用包含默認Python安裝的OSX,在您的環境中可能存在一些衝突的Ipython副本,其中的不同版本由常規和調試配置調用?

通過將項目移動到根包無法干涉的虛擬環境,可能解決了此問題。

0

爲了擺脫cython missing警告,運行:

python2 /.......git/liclipse/plugins/org.python.pydev_6.2.0.201711281546/pysrc/setu p_cython.py build_ext --inplace 

最後調試窗口保持乾淨,那些可怕的警告和雜亂的。