I am running a project using a remote interpreter using an SSH connection (PyCharm professional 2016.3.3). When I have a connection everything works fine, but if my connection gets interrupted (either I accidentally close the laptop lid, enter sleep mode, or the wifi connection breaks momentarily for some unknown reason) then when I reconnect, my console session is terminated with Process finished with exit code -1
.
The output from the interactive console reads:
ssh://username@remote_server:22/usr/bin/python /home/some_path/.pycharm_helpers/pydev/pydevconsole.py 0 0
PyDev console: using IPython 5.1.0
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
>>> a = 1
>>> # At this point I break the connection and then re-establish it after about 1 min.
Process finished with exit code -1
In this example I disabled wifi, and then re-enabled, connecting to a different wifi source, and then connected back to the orignal wifi source. This happens moderately frequently (maybe once daily) and can be a real hindrance.
Is there perhaps a setting I can change to avoid this, or is there a more robust connection method to attach the console to the process running on the remote host? The ideal situation would be one where if I lost my connection with one wifi source and opened a connection with another then my process would not be killed.
NB - It is important that I can have an interactive session, as my work is research based and I would need to be able to interactively write and run code.
Remote Debugging with PyCharm. With PyCharm you can debug your application using an interpreter that is located on the other computer, for example, on a web server or dedicated test machine. PyCharm provides two ways to debug remotely: Through a remote interpreter.
Waiting for process connection... When stopping the remote application with CTRL-C the stdout/stderr is nonetheless transmitted to PyCharm and appears in the debug console: Waiting for process connection... Server stopped. Like if the connection was opened and closed at the same time.
In order to debug with a remote interpreter, you have to start your program through PyCharm, which is not always possible. On the other hand, when using the Debug Server, you can connect to a running process. Compare the two approaches.
However, when I change code, changes do get automatically pushed toward this same remote host with no problem. I can also browse to the virtual environment on the remote host (through PyCharm).
I am also looking for a solution to this problem. The only workaround that I can think of for now is to set the keep alive message interval to a very high value under Tools>Deployment>Configuration>Advance Options. Maybe this solves the problem that the process finishes (But I couldn't test this yet).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With