Why is no exception raised for file.read() when file is only writeable?
Peter Haight
peterh at sapros.com
Thu Jul 1 12:54:27 EDT 1999
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