having trouble importing a module from local directory

vduber6er ericcngan at gmail.com
Fri May 12 16:21:35 EDT 2006


First off this is in unix.

I have a C file that has python embedded in it.  In the script I have
the following

PyRun_SimpleString(code);

where
code = "import mymodule"

however I get this error

Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named mymodule
Object not found
Segmentation fault

If i just run python from my local path then type "import mymodule" in
the python prompt this is fine.  I'm guessing when I am embedding my
python script in the C code the local directory is no longer the
directory where my C code resides.  How can i tell python to load the
module from my current local directory?  

Thanks.




More information about the Python-list mailing list