after embedding and extending python (using swig) problem importing (non-core) modules
Kingdom.lin at yeah.net
Wed Dec 8 07:05:39 CET 2004
Du you use program in linux? I work in windows, but I think it's a way to tell your program the module path like this:
char path[MAX_PATH], cpy_cmd[MAX_PATH];
GetCurrentDirectory( MAX_PATH, path );
sprintf( cpy_cmd, "sys.path.append(r\'%s\\modules\')", path );
PyRun_SimpleString("import sys"); // load built-in module sys
PyRun_SimpleString( cpy_cmd ); // set my modules path
"stefan" <schu0999 at gmail.com> wrote in message news:1102479704.220397.59070 at c13g2000cwb.googlegroups.com...
> Hi Folks,
> I currenty extended some of my C++ functionality to python and also
> embedded python to use python functionality in my C++ system (and use
> as well these extended functions).
> While this works fine with the core python functionality, as soon as I
> run a script (on the embedded system) which tries to import modules
> which are not in the core system, like "xml" or "re", it fails and says
> it cannot find the related dll (for example in the case of re the
> _sre.pyd). It works fine if i run the script with the 'regular'
> It does not look like a path-problem to me, so I'm clueless right now.
> I could work around this extending some functions to python and use
> them, but then I lose what I was aiming for, the "power" of python and
> Do i have to tell the embedded python system somehow where to look for
> extension dll's? (it even does not work if i have the pyd files in the
> (same) folder than the system where I start my embedded python program.
> It would be great if someone would have an idea, at least how to get me
> started on this.
> thanks a lot in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list