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 be closed when the PyHANDLE object is deallocated. Did you try to use the Detach() method? Something like fd = open_osfhandle(h.Detach(), os.O_RDONLY) Documentation says: "You would call this function when you need the underlying win32 handle to exist beyond the lifetime of the handle object" which seems adequate here. -- Amaury Forgeot d'Arc
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32