[ python-Bugs-1653416 ] print >> f, "Hello" produces no error: normal?
SourceForge.net
noreply at sourceforge.net
Tue Feb 6 19:49:05 CET 2007
Bugs item #1653416, was opened at 2007-02-06 10:23
Message generated for change (Comment added) made by montanaro
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1653416&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: E.-O. Le Bigot (eolebigot)
Assigned to: Nobody/Anonymous (nobody)
Summary: print >> f, "Hello" produces no error: normal?
Initial Comment:
When using
print >> f, "Hello"
on a file f opened for reading, no exception is raised. Is this normal?
This situation has to be contrasted with
f.write("Hello")
which raises an exception.
Details with Python 2.5 (r25:51908, Sep 24 206) on OS X 10.4.8 / darwin 8.8.0:
In [1]: f=open("start.01")
In [2]: f.write("Hello")
<type 'exceptions.IOError'>: [Errno 9] Bad file descriptor
In [3]: print >> f, "Hello"
In [4]: f.close()
NB: file f is not modified, despite the "print" statement yielding no error, above.
----------------------------------------------------------------------
>Comment By: Skip Montanaro (montanaro)
Date: 2007-02-06 12:49
Message:
Logged In: YES
user_id=44345
Originator: NO
I verified this behavior on my Mac with /usr/bin/python, Python 2.5 and
Python 2.6a0, both built from SVN.
Skip
----------------------------------------------------------------------
Comment By: E.-O. Le Bigot (eolebigot)
Date: 2007-02-06 11:45
Message:
Logged In: YES
user_id=1440667
Originator: YES
Interesting point, about Linux. The incorrect behavior is even seen in
the default python 2.3 that ships with Mac OS X!
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2007-02-06 11:31
Message:
Logged In: YES
user_id=849994
Originator: NO
If this happens, it's a bug. Though it doesn't seem to occur under Linux
here.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1653416&group_id=5470
More information about the Python-bugs-list
mailing list