How to debug long running python scripts or services remotely?

前端 未结 1 1952
夕颜
夕颜 2021-02-09 13:21

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条回答
  •  爱一瞬间的悲伤
    2021-02-09 14:22

    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.

    0 讨论(0)
提交回复
热议问题