On Mar 21, 4:48 pm, "John Pye" <[EMAIL PROTECTED]> wrote: > > I am trying the following... any thoughts? > > %typemap(in) FILE * { > if (!PyFile_Check($input)) { > PyErr_SetString(PyExc_TypeError, "Need a file!"); > return NULL; > } > %#ifdef __MINGW32__ > PyFileObject *fo = (PyFileObject *)$input; > $1 = fdopen(_fileno(fo->f_fp),PyString_AsString(fo->f_mode)); > > fprintf(stderr,"FDOPEN(%d,\"%s\")\n",fo->f_fp,PyString_AsString(fo->f_mode)); > > %#else > $1 = PyFile_AsFile($input); > %#endif > > }
Ok, so this didn't work. 'fdopen' returned NULL. I guess that nails the coffin for the fileno() approach? Cheers JP -- http://mail.python.org/mailman/listinfo/python-list