Why is no exception raised for file.read() when file is only writeable?
Peter Haight
Peter.Haight at p98.f112.n480.z2.fidonet.org
Wed Jun 30 22:54:27 EDT 1999
From: Peter Haight <peterh at sapros.com>
I've been helping someone learn the language and he was having trouble
understanding why this didn't work:
test=open('testfile','w')
testread=test.readline()
I explained to him the problem, but I was wondering why Python doesn't raise
an exception when you do this. He probably wouldn't have had to ask me
anything if Python printed something like this:
IOError: [Errno X] You can't read from a file only open for writing.
More information about the Python-list
mailing list