How to debug long running python scripts or services remotely?

只愿长相守 提交于 2019-12-04 12:17:51

问题


Pretty much what the title says, I would like to be able to connect to a python process running under paster or uwsgi and utilize pdb functionality.


回答1:


Using winpdb, you can attach to a running process like this:

  1. Insert

    import rpdb2; rpdb2.start_embedded_debugger('mypassword')
    

    inside your script.

  2. Launch your script (through paster or uwsgi) as usual.
  3. Run winpdb
  4. Click File>Attach
  5. Type in password (e.g. "mypassword"), select the process.
  6. To detach, click File>Detach. The script will continue to run, and can be attached to again later.


来源:https://stackoverflow.com/questions/7082093/how-to-debug-long-running-python-scripts-or-services-remotely

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