[Pyrex] Unexpected NameError (was: Handling exception when embedding)
Franck Pommereau
pommereau at univ-paris12.fr
Wed Nov 21 07:21:52 CET 2007
Greg Ewing wrote:
>>> Is the Pyrex module initialisation code getting called?
>>
>> I call it, and the rest of the global variables is available...
>
> In that case, I don't know what's going on. It
> doesn't look like it should be any different from
> any other module global.
Here is the faulty code. I'm sorry that it is a bigger example than my
stripped down version on which I cannot reproduce the error. Actually,
the Pyrex code itself is not longer, but there is the Python library
(called SNAKES). I attach it as a tar.gz file that just can be unpacked
where the file snk.pyx lives. I've put comments in snk.pyx to point
where the problems are.
The attached version of SNAKES is the current one not yet released, if I
use the version released at
http://www.univ-paris12.fr/lacl/pommereau/soft/snakes/snakes-0.8.7.tar.gz
I get yet another error: a NameError on 'snk' in snk_new_Place.
Wrt my last example, I've added some global statements at the module
level also. I'm not sure this is necessary but Pyrex's doc seems to ask
to do so (not sure if I understood well).
A bit of comment about the line
snk = snakes.plugins.load("pos", "snakes.nets", "snk")
in case this has a role in the error... This builds (with
imp.new_module) an return a new module that is copied from snakes.nets
(using __dict__.update), with new classes from snakes.plugins.pos, some
are classes defined at module level in snakes.plugins.pos, some are
classes defined in a sub-function of it that extend classes from
snakes.nets (this is how my plugin system works). The new module is also
installed in sys.modules at the key 'snk'.
I'd really appreciate any clue about what's going on...
Franck
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: snk.pyx
Url: http://lists.copyleft.no/pipermail/pyrex/attachments/20071121/fe91c990/attachment-0001.ksh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snktest.c
Type: text/x-csrc
Size: 372 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20071121/fe91c990/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snakes.tar.gz
Type: application/x-gzip
Size: 63685 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20071121/fe91c990/attachment-0003.bin
More information about the Pyrex
mailing list