Re: cimport problems with Python 2.6

Francesc Alted <[email protected]> Tue, 2 Sep 2008 11:22:36 +0200
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
A Tuesday 02 September 2008, escriguéreu:
> Francesc Alted wrote:
> > from tables.utilsExtension cimport malloc_dims, get_native_type
> >
> > but the error is now:
> >
> > Name 'malloc_dims' not declared in module 'tables.utilsExtension'
>
> This looks like the Pyrex compiler doesn't know that
> 'utilsExtension' belongs to the package 'tables'. It
> needs to know, otherwise various things will go wrong.
>
> The currently recommended way is to lay out your
> source files in a Python-like package directory
> structure with an __init__.py file, e.g.
>
>    tables
>      __init__.py
>      utilsExtension.pxd
>      utilsExtension.pyx
>
> There is more info about this in the Language Overview
> under "Source Files and Compilation".

You are right.  I've converted the file structure to what you are 
suggesting and the problem has gone.

Thanks a lot!

-- 
Francesc Alted