Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Mark Hammond
On 18/12/2011 4:34 AM, Scott Leerssen wrote: On Dec 17, 2011, at 12:25 PM, Amaury Forgeot d'Arc wrote: 2011/12/17 Scott Leerssen sleers...@gmail.com mailto:sleers...@gmail.com I did see that, but I interpreted that to mean that the PyHANDLE would be dereferenced from the underlying

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Scott Leerssen
On Dec 19, 2011, at 4:32 PM, Mark Hammond wrote: On 18/12/2011 4:34 AM, Scott Leerssen wrote: On Dec 17, 2011, at 12:25 PM, Amaury Forgeot d'Arc wrote: 2011/12/17 Scott Leerssen sleers...@gmail.com mailto:sleers...@gmail.com I did see that, but I interpreted that to mean that the

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Amaury Forgeot d'Arc
2011/12/19 Scott Leerssen sleers...@gmail.com I just tried that, and after closing the file object and attempting to call win32api.ClosHandle() on the value returned by detach, I get an exception of error: (6, 'CloseHandle', 'The handle is invalid.') Here's what the code looks like:

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-19 Thread Scott Leerssen
On Dec 19, 2011, at 7:38 PM, Amaury Forgeot d'Arc wrote: 2011/12/19 Scott Leerssen sleers...@gmail.com I just tried that, and after closing the file object and attempting to call win32api.ClosHandle() on the value returned by detach, I get an exception of error: (6, 'CloseHandle', 'The

[python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-17 Thread Scott Leerssen
Greetings! Apologies in advance for the length of this post; after many days of scouring Python and Windows news groups, I've seen reports of issues similar to mine, but no cause or resolution other than re-trying an operation. I'm in no way a Windows programmer; I've spent my entire career

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-17 Thread Amaury Forgeot d'Arc
2011/12/17 Scott Leerssen sleers...@gmail.com Closing the PyHANDLE leaves the file object with an invalid descriptor, and closing the file object leaves the PyHANDLE with an invalid descriptor, but only sometimes After open_osfhandle(), the handle is owned by the file object, and should not

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-17 Thread Scott Leerssen
On Dec 17, 2011, at 11:36 AM, Amaury Forgeot d'Arc wrote: 2011/12/17 Scott Leerssen sleers...@gmail.com Closing the PyHANDLE leaves the file object with an invalid descriptor, and closing the file object leaves the PyHANDLE with an invalid descriptor, but only sometimes After

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-17 Thread Amaury Forgeot d'Arc
2011/12/17 Scott Leerssen sleers...@gmail.com I did see that, but I interpreted that to mean that the PyHANDLE would be dereferenced from the underlying Windows file handle, It's the other way round: the PyHandle just forgets the win32 handle value, and will not close it in its __del__. --

Re: [python-win32] file descriptor issues using msvcrt.open_osfhandle()+os.fdopen()

2011-12-17 Thread Scott Leerssen
On Dec 17, 2011, at 12:25 PM, Amaury Forgeot d'Arc wrote: 2011/12/17 Scott Leerssen sleers...@gmail.com I did see that, but I interpreted that to mean that the PyHANDLE would be dereferenced from the underlying Windows file handle, It's the other way round: the PyHandle just forgets the