[Pyrex] C-API implementation in Pyrex 0.9.6

Stefan Behnel stefan_ml at behnel.de
Tue Oct 16 12:16:04 CEST 2007


Stefan Behnel wrote:
> Stefan Behnel wrote:
>> Greg Ewing wrote:
>>> However, the
>>> generated code should at least compile and work correctly
>>> the way things are, if you declare things in the right places
>>> and cimport them where they're needed.
>> It compiles now, but it fails on the initial import. I have two modules,
>> "lxml.etree" and "lxml.objectify". The objectify module cimports (and imports)
>> the etree module. Given that the stacktrace mentions line 1 in objectify.pyx,
>> I would say it's the cimport that fails here. One more thing to fix...
>>
>> Traceback (most recent call last):
>>     from lxml import objectify
>>   File "objectify.pyx", line 1, in objectify
>> ImportError: No module named etree
> 
> I forgot to mention that this uses a package local import, so the first lines
> of lxml/objectify.pyx look like this:
> 
>     from etree cimport _Document, _Element, ElementBase
>     from etree cimport _ElementIterator, ElementClassLookup
>     from etree cimport elementFactory, textOf
>     cimport etree as cetree

I think the problem here is that __Pyx_ImportModule() does not take the
current package into account. I'll fix it to first try an import based on the
package of the current module and then try a global import.

Stefan




More information about the Pyrex mailing list