
lallous at lgwm
Nov 25, 2009, 6:27 AM
Post #2 of 2
(146 views)
Permalink
|
|
Re: How to import a file by its full path using C api?
[In reply to]
|
|
Looks like one way to do that is to use something like: s.sprintf( "import imp\n" "imp.load_source('%s', r'%s')", modname, script_path); PyRun_SimpleString(s.c_str()); Unless someone has a better suggestion. Regards, Elias "lallous" <lallous [at] lgwm> wrote in message news:heir4g$ohv$1 [at] aioe > Hello > > PyObject* PyImport_ImportModule( const char *name) > > How to specify a full file path instead and a module name? > > Like PyImport_SomeFunction(const char *path_to_script, const char *name) > > Thanks, > Elias -- http://mail.python.org/mailman/listinfo/python-list
|