problem using import from PyRun_String
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Wed Apr 9 03:00:13 EDT 2008
En Tue, 08 Apr 2008 22:01:18 -0300, Patrick Stinson
<patrickkidd.lists at gmail.com> escribió:
> I'm creating a module with PyModule_New(), and running a string buffer as
> the module's text using PyRun_String and passing the module's __dict__ to
> locals and globals.
Why? Do you want to fake what import does?
> I'm having a problem using the import statement from
> within PyRun_String(). It complains about "__import__ not found", which
> after a quick grep it looks like the exception is raised from
> PyExc_EvalFrameEx() in ceval.c after f->f_builtins module doesn't contain
> "__import__".
> What __builtin__ module does that point to? a quick print of the
__builtin__ holds all the builtin objects, what a surprise! :)
http://docs.python.org/lib/module-builtin.html
> Any help?
What do you want to do actually?
--
Gabriel Genellina
More information about the Python-list
mailing list