As being a savvy programmer, it is vital to have a debugger along with the development. Today I spent two+ hours configuring the python debugger in the Eclipse IDE. (Yes, i feel a need to set it up as i just started dealing with the massive python scripts at my work). After nailing it down i would like to share how I set up.
1) Eclipse IDE installed. (At the time of writing, I am using Eclipse Luna 4.4 version)
2) Pydev Eclipse plugin installed. (http://pydev.org/download.html)
Then, depends on which way we want, we can do:
–To debug a remote program
1) Inside the Eclipse, start the remote debug server. If we don’t find it in the tool bar, we can go to Window > Customize perspective > Command groups availability > PyDev debug
2) In the external python script, put these two lines at the begining:
import sys;sys.path.append(r’/Users/ken/eclipse/plugins/org.python.pydev_22.214.171.1248187472/pysrc’) #assuming this is the pydev installation path
3) In the external python script, put this line anywhere you want to have the program paused at the debugger:
3) Inside the Eclipse, go to the debug perspective
4) there you go, you should be able to pause the execution at where you put the statement at in step 3) above
–To debug a program inside a Eclipse
This is much more easier than debugging a remote program. It is pretty much like debugging a java program in Eclipse.
1) Create a debug configuration: Go to Run -> Debug Configurations -> Python Run, create a profile accordingly
2) Hit Debug