problem with import path on a python C extension

Carsten Haese carsten.haese at gmail.com
Mon Feb 9 22:02:22 CET 2009


fredbasset1000 at gmail.com wrote:
> [...]
> So my question is why can't Python locate the new extension module
> when I try to import it with "import project.drivers.dio.diomodule"?
This import statement binds the module to the name
"project.drivers.dio.diomodule". It does not bind anything to the name
"diomodule", which is the name you want to use to refer to the module.

To bind the "diomodule" name to this module, you can do one of two things:

1:
   from project.drivers.dio import diomodule

2:
   import project.drivers.dio.diomodule
   diomodule = project.drivers.dio.diomodule

Hope this helps,

--
Carsten Haese
http://informixdb.sourceforge.net



More information about the Python-list mailing list