Remote Debugging

I have a small script to remotely debug a memory leak, on the raspi. I have no gui on the raspi.  I know how to import and pydev.pydevd.settrace(<host name>, port=<port number>)

is <hostname> = raspi ?

can I pip install pydev on the Raspi?

can I then run Pycharm remotely and connect?

Please assist.

C-:
0
23 comments
Avatar
Permanently deleted user
Hi Cornie,
<hostname> is a name of the host where Pycharm is running.

You don't need to install pydev on the Raspi you can just copy pycharm-debug.egg and add it to the PYTHONPATH.

You don't need to run PyCharm remotely, it should be running on your local machine.

Module structure has changed recently in pycharm-debug.egg so it is just:

import pydevd
pydevd.settrace(...)


Btw if you have SSH/SFTP access to your Raspi you could try using the feature called Remote Interpreter - it should make remote debugging easier.

Feel free to ask if you have any questions.
0
Avatar
Permanently deleted user
Thanks for offering help.

I only have SSH at the moment.  This means to copy the .egg is a challenge for a noob like me.

Is the remote interpreter the right way to debug the memory leak?

C-:
0
Avatar
Permanently deleted user
Remote interpreter is considered the right way to run and debug your process remotely. Please try http://www.jetbrains.com/pycharm/webhelp/configuring-remote-interpreters-via-ssh.html
0
Avatar
Permanently deleted user
The deployment screen needs a vertical scrollbar as the heigth exceeds that of my netbook display, can barely see webserver URL
0
Avatar
Permanently deleted user
Could you please create an issue with a screenshot at http://youtrack.jetbrains.com/issues/WEB
0
Avatar
Permanently deleted user
Another noob question /usr/bin/python does not exist on Raspi, where now?

C-:
0
Avatar
Permanently deleted user
/usr/lib/python2.7 correct path for interpreter?
0
Avatar
Permanently deleted user
it could be, you can use file chooser to find an interpreter
0
Avatar
Permanently deleted user
Using the file chooser worked /usr/bin/python
0
Avatar
Permanently deleted user
I do not use these:
Failed modules
Remote Python 2.7.3(ssh://pi@10.0.0.3:22/usr/bin/python)
RPi.GPIO
pygame._numericsndarray
pygame._numericsurfarray
Generation of skeletons for the modules above will be tried again when the modules are updated or a new version of generator is available.

Can I proceed?
0
Avatar
Permanently deleted user
Yes
0
Avatar
Permanently deleted user
I get:

ssh://pi@10.0.0.3:22/usr/bin/python -u /home/pi/.pycharm_helpers/pydev/pydevd.py –multiproc –client '0.0.0.0' –port 56359 –file /home/cornie/Dropbox/Calibration/display/serv-clnt/dserver.py

bash: line 0: cd: /home/cornie/Dropbox/Calibration/display/serv-clnt: No such file or directory

pydev debugger: process 5393 is connecting

Connected to pydev debugger (build 125.92)
pydev debugger: warning: trying to add breakpoint to file that does not exist: /home/cornie/Dropbox/Calibration/display/serv-clnt/dserver.py (will have no effect)

...etc

How do I load the correct file please from:

ssh://pi@10.0.0.3:22/home/pi/display/dserver.py

please?

C-:
0
Avatar
Permanently deleted user
Have you set up mappings in the Deployment configurations? Anyway you can set a mapping in your run configuration(see Path mappings editor) it should be /home/cornie/Dropbox/Calibration => /home/pi if it is your project directory.
0
Avatar
Permanently deleted user
Nearly there, running and pausing work, breakpoints not.  See:

3  16:26:56   2013-04-17  

pydev debugger: warning: trying to add breakpoint to file that does not exist: /home/pi/display/dclient.py (will have no effect)
pydev debugger: warning: trying to add breakpoint to file that does not exist: /home/pi/display/dclient.py (will have no effect)

By the way, breakpoints are not _that_ important at this stage, how do I find memory leaks!

C-:
0
Avatar
Permanently deleted user
Do you have the remote file with such name? Do you use symlinks?
0
Avatar
Permanently deleted user
That is the remote filename, symlinks? what is that?  I am a noob, sorry.  I really need to find a memory leak so breakpoints are not important?

I will follow any suggestions carefully, thanks!

C-:
0
Avatar
Permanently deleted user
Unfortunately I can't help you to find memory leaks in your program. I can only help you to set up the PyCharm to debug remotely :) Consider using some memory profiling tools like Heap(you can find a bunch of them in Internet).
0
Avatar
Permanently deleted user
I can start and pause the program remotely but cannot set breakpoints or edit.  How do I load the program via ssh?
0
Avatar
Permanently deleted user
To edit your program and upload it via ssh you can use Deployment feature, please read for detailed information http://www.jetbrains.com/pycharm/webhelp/remote-hosts.html

Note that you can't edit the program remotely, you need to edit it locally and upload then to the remote server.

To understand why can't you set breakpoints I need to know do you have the file /home/pi/display/dclient.py

To check this out you can run ssh terminal using Tools | Run SSH Terminal action and write there ls /home/pi/display/dclient.py
0
Avatar
Permanently deleted user
ls /home/pi/display/dclient.py

does not exist remotely.  See config below?

image1
0
Avatar
Permanently deleted user
Ok. So it's not intended to be executed remotely as far as I understand.
0
Avatar
Permanently deleted user
Yes, only dserver.py.
0
Avatar
Permanently deleted user
Got it going!  Thanks Dmitry!

Had the dserver.py file synchronised as well as mapped:-{

Will now start debugging the memory leak, thanks again, great service!

C-:
0

Please sign in to leave a comment.