PyCharm remote debug server pydevd_charm problem
I am trying to setup pycharm remote debug server following the instruction here https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html#remote-debug-config (Remote debugging with the Python remote debug server configuration).
I installed pydev_pycharm using pip install pydevd-pycharm~=version on the ~/.local directory of my remote server, then I added the following lines to the script on my remote server:
import pydevd_pycharm
pydevd_pycharm.settrace('server_name', port=22, stdoutToServer=True, stderrToServer=True)
However, when running that script on my remote server, I received the following error:
Traceback (most recent call last):
File "/home/user_name/.local/lib/python3.6/site-packages/_pydevd_bundle/pydevd_comm.py", line 316, in _on_run
cmd_id = int(args[0])
ValueError: invalid literal for int() with base 10: 'SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8\r'
Can't process net command: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
Any suggestions on what's the potential problem here?
请先登录再写评论。
I got the same issue. Honestly it must be a bug in the system. It's supposed to read this line as a command.
Hi Noga, could you please create a ticket in our bug tracker and provide idea.log from Help | Show Log in ... and the description of your setup? Unfortunately, I had no luck reproducing it =(
Ran into same issue. I have tried to use both host name and IP address, and still got the same error. Here are the code:
Traceback (most recent call last):
File "/export/home/wwwww/.local/lib/python3.7/site-packages/_pydevd_bundle/pydevd_comm.py", line 309, in _on_run
cmd_id = int(args[0])
ValueError: invalid literal for int() with base 10: 'SSH-2.0-OpenSSH_7.4\r'
Can't process net command: SSH-2.0-OpenSSH_7.4
I am running on Mac. Pycharm Pro version 2019.2 (Build 192.5728,xxx).
Remote server is linux RHEL7.5. Package pydevd-pycharm 192.7142.79 was pip installed on Linux, running with python 3.7 (python 3.6 probably would work the same).
Note that I was able to set up to use remote ssh, and was able to run a simple python program like this (not using any pydevd_pycharm here).
Hi CChung, how did you run your script on the remote machine? Did you SSH manually and execute it in the terminal?
Hi I am logging in from a different account.... I have tried running the scripts in both ways: invoked from pycharm on my Mac using remote ssh interpretor (Run). The other way is to manually logging in and run it in the remote Linux server. In both cases, they work when I don;t have the pydevd_pycharm.settrace( ) call. They both failed with the same error message when I have the line pydevd_pycharm.settrace( ).
Ah, I think I got the problem. You are using 22 port to call pydevd_pycharm.settrace. Please either select a different port as 22 is already in use by OpenSSH. If all other ports are blocked you need to setup SSH port forwarding.
@Pavel, I have answered your point in another thread, but the short answer is no port 22 is the port number of remote machine sshd incoming port. Port 22 is the correct one. If you specify a different port number say 9922, it will result in ConnectionRefuse type of error (as there is no server listening to 9922)
That's why one
22 is used by sshd, it cannot be simultaneously used by Debug Server.