Best way to test if a file descriptor is valid?
Erik Max Francis
max at alcyone.com
Mon Feb 24 22:57:29 EST 2003
Noah wrote:
> I have a method that is passed an open file descriptor.
> This file descriptor may have been opened from a file or
> from a serial device or whatever. Is there a good way to test if
> the file descriptor is valid and available for read/write?
Why not just use it as you would normally and then just catch and handle
the OSError/IOError that gets raised if it's invalid?
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ I thought I might never see another Saturday night.
\__/ Robert S. MacNamara
Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
A personal guide to Aliens vs. Predator 2.
More information about the Python-list
mailing list