comalex3
comalex3

Reputation: 2606

How to debug remote python script?

I am looking for a way to debug remote python script without any set up like in the answer here

I set remote interpreter, set up a debug configuration, click a debug button and got error Event not found:

ssh://myuser@my_ip:my_port/usr/local/bin/python -u /myuser/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support --client '0.0.0.0' --port 46994 --file /opt/my_work_dir/my_script.py
/: Event not found.

enter image description here

Seems like pyCharm takes care about all debug setting --multiproc --qt-support --client '0.0.0.0' --port 46994 but I have the wrong configuration.

Is there a way how to debug python script without putting pydevd.settrace('host', port=21000, stdoutToServer=True, stderrToServer=True) and other actions?

Upvotes: 1

Views: 3276

Answers (4)

Sunny
Sunny

Reputation: 11

It might be the same issue as this. Use bash as your login shell if you use another one like csh or tcsh.

Upvotes: 0

user2499577
user2499577

Reputation: 19

I was able to fix this problem by reinstalling PyCharm. (# 1 and 5 are optional)

  1. Export minimum settings you want to restore such as Keymap (File > Export Settings)
  2. Uninstall your current PyCharm
  3. Install new PyCharm
  4. Launch new PyCharm and don't import your pre-existing setting at the first start up
  5. Import your settings from the old PyCharm (File > Import Settings)

I guess this happens when some environment related settings are messed up. Notice that you need to remember your settings for the remote interpreter as it will be gone when reinstalling.

Upvotes: 1

RichArt
RichArt

Reputation: 1672

I set up remote debugging as described under the section

Remote debug with a remote interpreter

(not the Server!!) and it works very well.

Here the link: https://www.jetbrains.com/help/pycharm/2016.1/remote-debugging.html

You just have to set up the remote interpreter (I used ssh) and then set up your run configurations. Let me know if you need further help.

Here is my run configuration in PyCharm: enter image description here

Upvotes: 0

davidejones
davidejones

Reputation: 1949

I use vagrant quite often with pycharm and debugging has always worked great for me as long as i setup the interpreter to the one inside the vagrant box running.

If you go to settings->project->project interpreter and then setup a connection to your remote interpreter it will usually install the pycharm-debug.egg etc and you can debug run your project against this interpreter and set breakpoints in pycharm and it will break on those.

Here is their docs on setting this up https://www.jetbrains.com/help/pycharm/2016.1/configuring-remote-python-interpreters.html

Upvotes: 0

Related Questions