Embedding Python in C: Having problems importin local modules

Posted by Drew on Stack Overflow See other posts from Stack Overflow or by Drew
Published on 2010-05-26T23:51:45Z Indexed on 2010/05/27 0:01 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

I'm needing to run Python scripts within a C-based app. I am able to import standard modules from the Python libraries i.e.: PyRun_SimpleString("import sys")

But when I try to import a local module 'can' PyRun_SimpleString("import can") returns the error msg:

Traceback (most recent call last): File "", line 1, in ImportError: No module named can

When I type the command "import can" in iPython, the system is able to find it.

How can I link my app with can? I've tried setting PYTHONPATH to my working directory.

Thanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about c