[wingide-users] Re: Debugging internally started python processes
support at wingware.com
Thu Jul 22 12:05:19 MDT 2010
Edward Diener wrote:
> I am not sure how this debugging is meant to work and I do not believe
> the documentation makes it clear at all. Please provide examples in
> the future for debugging of embedded code which shows how this is
> supposed to work.
> My situation is:
> In first.py
> In second.py
> Some code that I want to start debugging.
> Do I put the wingdbstub.py and the wingdebugpw files in the directory
> where second.py exists and then an 'import wingdbstub' at the
> beginning of second.py ? Or does the wingdbstub.py and the wingdebugpw
> files go in the directory where first.py exists and then an 'import
> wingdbstub' goes before 'os.system('second.py')' ? It seems the first
> choice above is probably correct but your doc does not make this obvious.
Yes, you would 'import wingdbstub' in second.py and place a copy of
wingdbstub.py in the same directory as second.py or somewhere on the
Python Path that second.py will be using.
> To debug both first.py and second.py do I open the Wing IDE twice with
> the appropriate source files in the project with their breakpoints and
> then start debugging first.py and somehow the second IDE instance
> stops at the appropriate breakpoing after the os.system('second.py')
> triggers ?
Yes, open one instance of the IDE from which you'll start debugging
first.py. Then open another instance and make sure it's got Enable
Passive Listen checked in the menu that pops up when you right click on
the bug in the lower left of the window. Then add the 'import
wingdbstub' in second.py if not already there. Then start debugging in
the first instance of the IDE. first.py will invoke second.py which
loads the debugger and connects to the second instance of the IDE. This
works because the first instance of the IDE does not listen for debug
connections because it is already debugging and thus the second instance
handles the debug request from second.py. It's workable but still
easier to just debug one process at a time. In most cases only one will
be of enough interest to debug.
> If I am only concerned with debugging second.py do I just execute
> first.py ( or python first.py ) and an IDE instance,equivalent to the
> second one above, stops at the appropriate breakpoing after the
> os.system('second.py') triggers ?
If you only want to debug second.py, do the same thing but execute
first.py instead of debugging it. In this case you only need one IDE
instance that is set up to listen for debug connections ("Enable Passive
Please let me know if that is not clear.
Wingware | Python IDE
Advancing Software Development
More information about the wingide-users