[Pythonmac-SIG] Mac PyImport_ImportModule("modulename")

Zhi Peng zhiyong_peng2003 at yahoo.com
Sat Dec 10 05:45:38 CET 2005

Hi! Bob
  I have not tried to append current directory in sys.path. Maybe I need to do sth 
  sys.path.append("./") and then do import. The module is installed in MacPython package. The os module is in python23.dylib so it can find it and import it. But my module is just a py file. 

Bob Ippolito <bob at redivi.com> wrote:
On Dec 9, 2005, at 4:41 PM, Zhi Peng wrote:

> In my c code, I have used myMod=PyImport_ImportModule("moduleName") 
> and run on Mac, but it just can not import the "moduleName" for 
> some unknown reason.
> I am sure I install the "moduleName" by "pythonw setup install". 
> And I can import "moduleName" from command lines such as
> >pythonw
> >import moduleName
> >
> It is fine. I wonder why PyImport_ImportModule can not import it, 
> while it can import module os by using
> PyImport_ImportModule("os")
> Any suggestion?

Are you sure it's the same version of Python, and the module is on 
sys.path? Check sys.version and sys.path



Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20051209/29529242/attachment.htm

More information about the Pythonmac-SIG mailing list