breaking on unhandled exceptions in pydev/gae

*爱你&永不变心* 提交于 2019-12-11 10:57:56

问题


i am using pydev to develop a google app engine application. i followed the steps mentioned here to configure pydev debugger to break on unhandled exception. i could get it to work on a sample pydev project, but when i try the same steps in my pydev gae project, it doesn't work and gives following error:

pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower) pydev debugger: starting ...
Traceback (most recent call last):
File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 3858, in _HandleRequest self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 3792, in _Dispatch base_env_dict=env_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 580, in Dispatch base_env_dict=base_env_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 2918, in Dispatch self._module_dict) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 2822, in ExecuteCGI reset_modules = exec_script(handler_path, cgi_path, hook) File "c:\program files\google\google_appengine\google\appengine\tools\dev_appserver.py", line 2702, in ExecuteOrImportScript exec module_code in script_module.dict File "C:\Users\siddjain\workspace\rfad\src\main.py", line 1, in import pydevd ImportError: No module named pydevd

my debug configuration for gae project is like this:

the sample pydev project where it works is like this and am following same pattern in my gae project:

import pydevd

def f(x,y):
    z = y/x;
    return z;

def main():
    pydevd.set_pm_excepthook()
    print f(0,0)

if __name__ == '__main__': 
    main()

the run config for test project is like this:

the pydevd.py module is under C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc. Although this path is not included in the pythonpath for test project, the breaking works in test. i also tried including this path in pythonpath of gae project to see if that fixes my problem, but it didn't


回答1:


Its still not fixed although following steps got rid of No module named pydevd error:
1. Create a symlink to C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc:
src>mklink /d debugger C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc
2. Put an empty __init__.py file in C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc. i learnt this from some google link that i can't find now.
3. In source code:
import debugger.pydevd as pydevd

after these steps its able to import pydevd, but still doesn't break on uncaught exception. The development server runs your application on your local computer for testing your application. The server simulates the App Engine datastore, services and sandbox restrictions (hence step 1). although i don't understand why we need to import pydevd since its pydevd who's running our application in the first place!
In the Run->Debug Configurations->Interpreter tab if I click on "see resulting command line..."
C:\Python25\python.exe -u C:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc\pydevd.py --vm_type python --client 127.0.0.1 --port 0 --file "c:\program files\google\google_appengine\dev_appserver.py"

The PYTHONPATH that will be used is:

C:\eclipse\plugins\org.python.pydev_2.0.0.2011040403\PySrc\pydev_si...



来源:https://stackoverflow.com/questions/5761928/breaking-on-unhandled-exceptions-in-pydev-gae

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!