[New-bugs-announce] [issue4237] io.FileIO('foo', 'rt') prints a RuntimeWarning

Amaury Forgeot d'Arc report at bugs.python.org
Thu Oct 30 02:02:18 CET 2008

New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:

>>> import io
>>> io.FileIO('foo', 'rt')
__main__:1: RuntimeWarning: Trying to close unclosable fd!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid mode: rt

The ValueError is expected, but the warning is not.
This happens on file deallocation: the file object is in an invalid 

messages: 75346
nosy: amaury.forgeotdarc
severity: normal
status: open
title: io.FileIO('foo', 'rt') prints a RuntimeWarning
versions: Python 2.6, Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list