cannot see variables after psyco import

nobody
2006-10-20
2013-03-15
  • nobody
    nobody
    2006-10-20

    The variables all say "cannot resolve variable" after I import psyco. This is before I actually tell psyco to compile anything. I execute this in the debugger:

    b=100
    import psyco
    print b

    with breakpoints before & after the import. Any ideas how to get around this? I want psyco in my released code but am tired of commenting out each psyco import to debug.
    Thanks
    Kim

     
    • Fabio Zadrozny
      Fabio Zadrozny
      2006-10-20

      Well, I've taken a look at that, and the problem seems to be that psyco 'drops' the frames from a thread and creates a new set of frames -- just by importing it (and the debugger is still attached to the old set of frames). Please report that as a bug.

      Now, you can have a little better structure instead of commenting out your code -- something like having a module that imports psyco:

      file: mypsyco.py

      if RELEASE:
          from psyco import *
      else:
      ... do your own wrappers for the functions that you use from psyco an no-ops.

      This way you could just pass a parameter to set that RELEASE flag...

      Cheers,

      Fabio