[wingide-users] Debugging internally started python processes

Wingware Support support at wingware.com
Wed Jul 21 07:53:46 MDT 2010

Edward Diener wrote:
> I am trying to debug a script where python is being reinvoked using 
> os.system('someCommand'), where the 'someCommand is first 'python 
> someScript.py someParameters' on one line and is then 'someScript.py 
> someScriptParameters' in another line.
> How can I get the debugger to debug whatever Python scripts are being 
> invoked in this way from within a script which I am already debugging ?
> Do I need to follow the Advanced Debugging Topic | Debugging 
> Externally Launched Code topics ? If so, how can I setup these two 
> situations where I can debug into these os.system calls ? I do have 
> the ability to change the script I am trying to debug but I do not 
> want to do it, if possible, in such a way where I must change the 
> os.system calls into something else since that seems to be where the 
> problem lies I am trying to solve. Needless to say the script just 
> hangs somewhere in one of the scripts being called by the second of 
> the os.system calls and I am trying to find out why.

The problem here, as you noticed, is that Wing can't debug into spawned 
sub-processes.  The only solution would be to use wingdbstub as 
explained in the above-referenced manual chapter. 

However, the IDE currently only supports one active debug session at a 
time, a limitation you may run into.  If you launch the first debug 
process from the IDE, then launch another instance of Wing and have it 
listen for debug connections, the second process should be able to 
import wingdbstub and connect to the second instance of Wing.  If you 
have three or more processes, it gets a bit trickier in that you need to 
configure different IDE instances to listen on different debugger ports 
and have each sub-process use a different wingdbstub with matching 
configuration.  Usually it's just easier to select one sub-process in 
that case and not debug all of them at the same time.

Please let me know if this does not help.



Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list