[wingide-users] Debugging one-off commands

Wingware Support support at wingware.com
Wed Sep 15 08:54:27 MDT 2010


cool-RR wrote:
> Hello,
>
> How can debug a one-off command in Wing?
>
> I'll explain what I mean.
>
> I'm developing a Django application, and I'm using `south` to manage 
> my migrations. It happened today that I wanted to perform a migration, 
> but when I typed `manage.py migrate my_app` in the shell, some error 
> happened and I got a traceback. I wanted to debug it using Wing, but 
> it wasn't obvious for me how to do it.
>
> What I ended up doing is editing the debug arguments of `manage.py`. I 
> cut out the `runserver ...` part and pasted it in a notepad, put in 
> `migrate my_app`, and solved the problem, and then pasted `runserver 
> ...` back from the notepad. I think this is not a pretty solution.
>
> What would be a good solution for this?

I usually add "import wingdbstub" to the code I'm trying to debug from a 
command line invocation.  Details of how to do this are in the manual:

http://wingware.com/doc/debug/debugging-externally-launched-code

Motivated by Django and other things like it we want to add multiple 
debug configurations per file so once that's there you could set it up 
in the IDE as another debug configuration for manage.py.  That's on my 
nearer term list.

The work-around for now is to use wingdbstub.  Incidentally you could 
add some code like this to manage.py:

if '--debug' in sys.argv:
  sys.argv.remove('--debug')
  import wingdbstub

Then you can debug any manage.py call from the command line by adding 
--debug arg.

I didn't understand why you had to edit with Notepad.  You should be 
able to edit the args in the Run Arguments field under the Debug tab in 
the File Properties for manage.py.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list