On Nov 10, 1:18 pm, Floris Bruynooghe <[EMAIL PROTECTED]> wrote: > On Nov 10, 11:11 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > 1. How can I pass a file-like object into the C part? The PyArg_* > > functions can convert objects to all sort of types, but not FILE*. > > Parse it as a generic PyObject object (format string of "O" in > PyArg_*), check the type and cast it. Or use "O!" as format string > and the typechecking can be done for you, only thing left is casting > it. > > Seehttp://docs.python.org/c-api/arg.htmlandhttp://docs.python.org/c-api/file.html > for exact details.
Sorry, I probably should have mentioned you want to cast the object to PyFileObject and then use the PyFile_AsFile() function to get the FILE* handle. Floris -- http://mail.python.org/mailman/listinfo/python-list