[embed] PyImport_Import cannot find xml.py
Gustavo Niemeyer
niemeyer at conectiva.com
Sun Mar 24 15:50:09 EST 2002
[...]
> >>> mod
> <module 'xml' from 'xml.py'>
[...]
> so that says that the module is locatable by the interpreter. but when i
> compile and run the following program:
That's probably because this module is not in the module search path.
Try running the following, after Py_Initialize():
PySys_SetPath(Py_GetPath());
> modname = PyString_FromString("xml");
> mod = PyImport_Import(modname);
You may use PyImport_ImportModule("xml").
> Does anyone have a working example of Pure Embedding? It's for my personal
> private project - for fun, supposedly, well before it was, not my
> assignment.
I've embedded python in a couple of projects. But the best project you
will find is python, since it's "embedded" in itself.
;-))
--
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
More information about the Python-list
mailing list