[wingide-users] import hook problems

Maciej Fijalkowski fijall at gmail.com
Wed Nov 8 14:10:18 MST 2006

On 11/8/06, Wingware Support <support at wingware.com> wrote:
> On Wed, 8 Nov 2006, Maciej Fijalkowski wrote:
> > 1. Make debugger hook call previous debugger hook in some circumstances
> > (like importing py.)
> > 2. Making an option to disable it
> >
> > Any other ideas how can I support in from library side?
> Using wingdbstub and importing that after pylib has set its
> import hook may solve your problem.  This requires launching your
> code from the command line and not from the IDE.  See
> http://wingware.com/doc/debug/debugging-externally-launched-code
> for more info.
> Or, change pylib to call whatever import hook was in place before
> its hook was installed.  It really should do that anyway when
> importing something other than its own magic modules.

That's how it actually work. Pylib overrides imports  for only modules
starting with py. (our own)
and calls any necessary magic was there before.

Be aware that presence of any import magic may mean Wing won't be
> able to find the modules' source code or correctly identify
> breakpoints, but it depends on how it's done.  In short, the
> source needs to be available on disk and the __file__ module
> attribute or co_filename in the code objects should be set
> to the full path to the source file.

I know. But probably tracebacks should get there for users anyway. How it
1. pylib is having lazy imports, which allows one to write
import py

and this "just" works. WindIDE importhooks are trying to access __path__ of
modules which are purely virtual
(they really does not exist, are just some glue of that). This explodes in
funny way, some random getattribute (cannot really track it, cause it's C

By chance, I'm working on the debugger code now and I'm pretty
> sure removing our import hook entirely won't really work right.
> I'll keep this in mind, though.

Basically for tests:

svn co http://codespeak.net/svn/py/dist/

make sure you can access it

and try

import py
from py.test import raises

in a debugger, and you'll get a crash.

Hope that helps.
> Stephan Deibel
> --
> Wingware
> Wing IDE for Python
> Advancing Software Development
> www.wingware.com

Thx for support!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/wingide-users/attachments/20061108/e9d2aae0/attachment.html

More information about the wingide-users mailing list