Gabriel Genellina wrote: > En Sun, 01 Apr 2007 01:35:59 -0300, Brendon Costa <[EMAIL PROTECTED]> > escribió: > >> How do i convert a _node* object returned from: >> PyParser_SimpleParseStringFlagsFilename() >> >> into a code object i can use as a module to import with: >> PyImport_ExecCodeModule() > > Using PyNode_Compile. But why don't you use Py_CompileXXX instead? > And look into import.c, maybe there is something handy. >
Thanks for the pointer. I am not using Py_CompileXXX because i could only find Py_CompileString... i could not find a file version of it (Which i thought should exist). My original email though i copied and pasted the wrong function into. Instead of: PyParser_SimpleParseStringFlagsFilename() i meant to use: PyParser_SimpleParseFileFlags() Basically i will open a FILE* for the file requested, parse it and load it into the module. Using this method i don't have to load its contents first into a string to be compiled, but just get the python library to parse directly from the file. It all seems to work fine now. Thanks for the help. Brendon. -- http://mail.python.org/mailman/listinfo/python-list