Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Module import path when embedding python in C

Reply
Thread Tools

Module import path when embedding python in C

 
 
graph
Guest
Posts: n/a
 
      09-26-2008
Per http://mail.python.org/pipermail/pyt...er/506206.html
something like this (plus error handling) seems to be the right way to
add to sys.path when embedding python in C:

PyObject *sys_path = PySys_GetObject("path");
PyObject *path = PyString_FromString("/your/path");
PyList_Append(sys_path, path);

Does anyone know why PySys_GetObject wasn't documented until somewhat
recently (http://bugs.python.org/issue1245) if it has been part of the
system module interface since at least Python 1.5.2? Is it not
supposed to be used? What's the difference the above and importing
the sys module and then doing the append?

Thanks in advance.

-g
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
imp.find_module don't found my module but standard import statement can import this module… why ? Stéphane Klein Python 0 07-05-2011 07:36 AM
Why 'import module' will not import module.py but the directorymodule? Peng Yu Python 0 10-31-2009 11:51 PM
how to import extension module from embedding application on aix5 zhang xiaoning Python 0 11-01-2005 04:46 AM
Handling import conflicts when module has the same name as a library module that it needs to import? plb Python 0 02-08-2005 01:08 PM
Handling import conflicts when module has the same name as a library module that it needs to import? plb Python 0 02-08-2005 01:01 PM



Advertisments