Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug PyDev+Eclipse - Code not reloads after code change in breakpoint/suspend mode

I often doing such steps and want to optimize debug speed:

  1. I am setting some breakpoints.
  2. I am running Google Appengine Application (Python 2.5.2+).
  3. When breakpoint occur I often change code to fix bugs.
  4. After code change want to test again but there is problem if I changed code in breakpoint/suspend mode the application does not updates with my code changes - thus requiring a slow reloading.

Does anybody have an idea of what is root cause of forcing reloading after suspend or it is PyDev Bug/Limitation?

like image 349
Chameleon Avatar asked Nov 22 '11 09:11

Chameleon


1 Answers

The way the debug works is not by executing the source line-by-line. The debug "compiles" your source to bytecode (the .pyc files) and execute those, not your source.

The debug only keeps track of what piece of the .pyc files correspond to what line of your .py ones and display that information for your convenience, but the .py file itself is not what the debugger is using to run the program.

Therefore, if you change the source / .py file and want the debugger to acknowledge those changes, you need to "recompile" the .pyc files first.

HTH!

like image 184
mac Avatar answered Oct 17 '22 14:10

mac