How to set up Remote Debugging for Python

I’ve read the documentation, but don’t get it! So I need confirmation that what I want to do is possible and then simple steps to achieve it.

My Python code resides on a Linux server. It can only run on the Linux server as it needs a Shared Library that has been compiled specifically for my version of Linux. If I run Komodo on the Linux server, I can step through my Python code perfectly well and the breakpoints all work.

However, if I have a lot of developers all running Komodo on my Linux server, it kills the server’s memory. Ideally I want the developers to use their Windows PCs and run Komodo on Windows. But, we cannot run our Python calculations on windows because the Shared Library only works on Linux.

I have set up Komodo (9.2) on Windows and I can open up and edit my code on the Linux remote server. But now I want to run my Python code and step through it and see the watch window in Komodo on Windows. Is this possible?

To report, I have Komodo IDE running on Windows. My Python code resides on the Linux remote server. How do I then run my Python script from the Windows version of Komodo? because when I click the Debug menu, all the run commands are greyed out?

Thanks

Hey @Paul,

Can you confirm that you’ve looked at our Remote Python Debugging docs? You should be able to do what you’re asking just by following those instructions.

EDIT: Note that you can’t start a remote debugging session from within Komodo. The definition (in our case with Komodo any way) of remote debugging is that the process is started outside Komodo and reaches out to Komodo to start a debugging sessions.

  • Carey

Thanks Carey,
I had looked at your docs but it was a misunderstanding on my part. The missing link is in your note. I wanted to trigger the debugging session from within Komodo not from the Linux machine.
I now have it working but it’s not going to help solve my issues - it’s too cumbersome. I want to be able to trigger the debug session from within Komodo just like we can when we work directly on the development server.
My issue is that I want to move my developers off the development server because we now have too many developers. I’m now thinking of setting up private Virtual Machines for each team and they can checkout an environment and the code from Git and work locally - but first need to move them to 64-bit Windows.
Thanks again for the quick response.
Paul

Hi Paul,

I think you need to create a toolbox command on your local Windows machine that executes

python -S **path/to/**pydbgp.py -d localhost:9000 **your-script.py**

on the remote Linux machine (replace the port with whatever port Komodo is listening on). However, I’m not exactly sure how you’d do it. One way is to use ssh to execute shell commands. Anyway, in the remote Linux machine’s script, you’ll need the

from dbgp.client import brk
brk(host="**mybox**", port=**9000**)

somewhere (perhaps on the first line) to initiate debugging on your local Windows machine.

Not that my opinion matters here but I really do think you should do this sooner than later. There are many ways that you can make this process quite painless (with some slight pain initially), for example writing a Vagrant file for your developers to use to automate VM setup. We do that for our Komodo website.

As @mitchell was saying, if you want to start the debugging session from you local machine, you will have to get fancy with an SSH command that sends a remote command to the server. You could also inject breakpoints into your code that when hit, would reach out to the specified box. These’s can be developer specific I believe (based on host).