I am new the raspberry pi and I have just started my python development on it. I have installed eclipse in windows along with pydev. I have even made a ssh connection from eclipse to pi so now I have access to all the files of pi.

I want to know is it possible to remotely debug python code. Why I want it is because lets say I have written a code in python which works fine in windows but when i run it in raspberry pi, it give some error. So debugging is important.

I have seen many tutorials on remotely debugging c/c++ code from within the eclipse. Is it possible with python.

Please help. Thanks.!


Here is how you can do to remote debug python scripts on pi from eclipse (windows):

  1. Install eclipse and pydev
  2. Install pydevd on pi using pip install pydevd
  3. In eclipse, create a new python project and add below lines at starting of the code:

    import sys;sys.path.append(<path to pydevd>)
    import pydevd;pydevd.settrace(<ip address of windows>, port=5678)
  4. Write your python code and copy the same python file on pi.
  5. Open debug perspective and start the pydevd debugger by clicking on pydev from menu options.
  6. Now execute python code on pi.
  7. It will automatically stop after settrace in eclipse.
  8. From now onwards you can step into your code and debug it.

Happy debugging :)

Just found a video of it https://www.youtube.com/watch?v=QHw4-xGeIlw&index=2&list=PLWw98q-Xe7iHQGQtppR14i7lm6-wJMjwf


You dont need to include the path to pydevd,so below lines should also work fine:

import sys
import pydevd;pydevd.settrace(<ip address of windows>, port=5678)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.