2to3 does not fix FileType from types Module; no replacement?

Benjamin Peterson benjamin at python.org
Wed Mar 18 07:48:36 EDT 2009


 <mkieverpy <at> tlink.de> schrieb:
> and I could not find a replacement for 'FileType'.
> Has this been overlooked?
> 
> Found this thread which does not mention FileType:
> http://mail.python.org/pipermail/stdlib-sig/2008-April/thread.html#172
> 
> I guess I just did not see something simple.
> Anyone with a hint?

That's because this isn't simple. Python 3 doesn't have one file type. It has
several different kinds of streams in the io module. If you're checking for a
file type, you'll want to use isinstance(some_file, io.IOBase). If you're
inheriting form it, I suggest you look at the io module's classes. 







More information about the Python-list mailing list