[Pyrex] Importing a python module

Mathijs Romans mathijs at romansland.nl
Mon Mar 31 09:47:22 CEST 2008


On Sunday 30 March 2008 22:25:45 Greg Ewing wrote:
> Mathijs Romans wrote:
> > the file ./sgf/sgf.pyx starts with:
> >
> > import glGo.utils
> >
> > The functions in utils.py can't be
> > found during runtime of the binary code.
>
> The 'import' statement in Pyrex works exactly the same way
> as it does in Python, i.e. any directory to be used as a
> package must have an __init__.py file, and top-level
> package directories must be in sys.path or PYTHONPATH,
> etc.
>
> All this happens at run time, so the Pyrex compiler
> knows nothing about it (as opposed to 'cimport', which
> is done at compile time).

Thanks for the information, it's amazing that this all works at run time. I 
now figured it out, the glGo.utils function were archived in a pythonlib.zip 
file that were imported as a python module at run time. The zip file was 
somehow out of date, causing silent failure. 

Mathijs



More information about the Pyrex mailing list