[wingide-users] Re: wingide-users Digest, Vol 45, Issue 13

Wingware Support support at wingware.com
Tue Jan 22 15:00:10 MST 2008


Tony Cappellini wrote:
> I would not use pysco inside of Wing nor any Python debugger.
> I had to do a conditional import to avoid it.
> 
> Psyco rearranges your byte code such the source code you think you are
> stepping through is not actually what is being executed. (that may not
> be an accurate description of what is actually happening, but
> effectively that is what's happening)
> 
> It's very misleading, maddening, and would suggest avoiding it if
> possible, unless you find some clever work-around.

One way to do this is to enclose import/invocation of psyco in
something like:

if not __debug__:
   import psyco
   # etc

This would only use psyco if running Python with the -O option.

Or, to make it specific to Wing's debugger being active do this:

import os
if not os.environ.has_key('WINGDB_ACTIVE'):
   import pysco
   # etc

Note however with that approach if you're using wingdbstub instead of
initiating debug from the IDE, then you would need to make sure
that's imported before psyco.

We may try to set Wing up to warn if psyco is active, and possibly
could try to disable it, tho I'm a bit leary of automagical messing
around with program functionality.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list