Re: Hooking __import__ when embedding the interpreter

2007-06-29 Thread Stefan Bellon
I think I solved all my three questions for myself now ... On Fri, 29 Jun, Stefan Bellon wrote: > 1) The above code seems to work ok when using the "import" statement, >but it does not when using the dynamic __import__ function. If >using it that way, I get: > > >>> sys=__import__("sys")

Hooking __import__ when embedding the interpreter

2007-06-29 Thread Stefan Bellon
Hi all, I am embedding the Python interpreter using the C API and extending it using modules generated by SWIG. In order to guarantee consistency about importing those modules, I would like to "hook" into the Python's import statement and __import__ function and do some checks there. I have exper