How to receive a FILE* from Python under MinGW?

Gabriel Genellina gagsl-py2 at
Wed Mar 21 07:02:39 CET 2007

En Wed, 21 Mar 2007 02:04:30 -0300, Ross Ridge  
<rridge at> escribió:

> Gabriel Genellina <gagsl-py2 at> wrote:

>> You can get the file descriptor from the Python file object using its
>> fileno() method. The file descriptor lives at the OS level, so it's safe
>> to pass around.
> Not under Windows.  Windows doesn't have Unix-like descriptors, so the
> C runtime emulates them.

Using get_osfhandle on that pseudo-descriptor gives a Windows file handle;  
that handle should be equivalent (that is, it has a similar role:  
identifies an open file uniquely inside a process, and is independent on  
the C runtime library)

Gabriel Genellina

More information about the Python-list mailing list