1

Due to some weird reasons, my current project works like this - i am getting the file from a development server and changing the file in my local system and pushing it back to server and testing it there.

As i am not able to execute in my local system debugging is tough.

I have full access to my dev server. Is there any way that i can connect to an IDE like Eclipse or IntelliJ and debug the script running in dev server?

I saw some options for ssh connection in IDE . Any article or any hint o debug a file in dev server will be helpful.

I am using python 2.2 !!

3
  • is it a cgi script? or what? why cant you run it locally? ... is it simple enough you could just add some print statements and run it by sshing in and entering python <script> we dont really have nearly enough info to be able to help you Commented Mar 20, 2014 at 22:20
  • 1
    i can add print statements , but my intention is to check the flow of the script . hmm like break points... but i think that doesnt make any sense !!!! Commented Mar 20, 2014 at 22:25
  • breakpoints do not make sense in a web development environment. typically server files you would write a test suite that runs against it I still dont understand what type of script it is (is it a flask application/django/cgi/ just a python script that you run by remoting into the machine/etc) Commented Mar 20, 2014 at 23:28

2 Answers 2

1

Get PyDev @ http://pydev.org/. Download and install the product as an eclipse plug-in.

Copy the contents of the pysrc directory to your remote system. pysrc directory is under the subdirectory for the PyDev plugin. go to where eclipse is installed. If it is /opt/eclipse, look for /opt/eclipse/plugins/org.python.pydev.debug_xxx.xxx/pysrc. You can copy the pysrc directory to the remote system wherever you like.

Change python code so that it contains a call to pydevd.settrace("dev box IP")

def start(session):
    sys.path.append("/tmp/pysrc") # this can be any folder you copied the pysrc folder in remote system
    import pydevd
    pydevd.settrace("devbox IP") # change this to correct IP

Start pydev remote debugging server on eclipse in dev box by clixking the toolbar bar icon (a picture of P with a bug next to it, got to Debug perspective if you can't find it in pydev perspective). And set a breakpoint on the code after the settrace statement. Now run the code in the remote server, the code breaks and you can see that in the dev box where the breakpoint is set.

Sign up to request clarification or add additional context in comments.

Comments

0

I am not sure exactly why you have a setup like this, but probably SSHFS can help? It can save you some time in transferring files back and forth, but debugging via IDE will not be an option.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.