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
More information about the Python-list mailing list
Thu Jul 1 12:54:27 EDT 1999
- Previous message (by thread): theads & global namespaces
- Next message (by thread): please help with simple regex
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message (by thread): theads & global namespaces
- Next message (by thread): please help with simple regex
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list