[Pyrex] Pyrex importing question.
Blake Winton
bwinton at latte.ca
Mon Nov 15 22:11:34 CET 2004
>>> This leads me to believe that the
>>> "import conduit.ConduitImpl" line is failing, but I
> >> don't know of any particularly good way to find out
> >> how or why.
>> Are you importing the Pyrex module in the normal way
>> from Python code (or another Pyrex module), or are you
>> doing something tricky like loading and calling it
>> directly from C code?
> As a side question, if I add debugging printfs to the
> generated C code, will it be overwritten by pyrex if the timestamp on
> the generated code is newer than the timestamp on the .pyx? (Sheesh, it
> would probably have taken me less time to just try it than to ask. So I
> tried it, and yeah, it doesn't re-generate the C-source.)
So I added some printfs (or fprintfs, to be specific) to the code to
trace the execution, and try to see what was happening.
// This message comes from my initbtest function.
initialization!
// The next two come from __Pyx_Import.
// "2" is the name of the module I'm trying to import.
PyxImport 2 conduit.ConduitImpl
// "3" is the address of the module after the
// PyObject_CallFunction(__import__, "OOOO",...) call.
// Yeah, it's null.
PyxImport 3 0
// This is in an extra function I added to try and see what the error I
// was getting was. It turns out it's an import error.
pyerror 1 exceptions.ImportError
// So I added some extra code which said:
// module = PyImport_Import( name );
// But the address of module is still 0/NULL after that, so it looks
// like a problem with the module itself.
PyxImport 4 0
pyerror 1 exceptions.ImportError
Can anyone offer me some source code to print out a stacktrace from
C-land? I've got code in there that does it, but it tries to import the
format_exception module, which then gives me a SystemError.
Thanks,
Blake.
More information about the Pyrex
mailing list