2017-02-04 | Paul Boddie | raw annotate files changeset graph | Removed recoding to UTF-8 since this failed for ISO-8859-15, causing UTF-8 recodings of byte sequences to occur, not producing such undesirable data for ISO-8859-1 only because of it being special-cased. This change may break other ASCII-incompatible encodings because UTF-8 is likely to be the safe form of such data, permitting the parser to understand it, and without such recoding the parser will no longer recognise the grammar's tokens. |
1 try: 2 f = open("tests/read_file.py") # this file! 3 except IOError, exc: 4 print "I/O error occurred:", exc.value 5 raise 6 7 try: 8 s = f.read(5) 9 print s # try: 10 s = f.read(49) 11 print s # f = open("tests/read_file.py") # this file! 12 s = f.readline() 13 print s # except IOError, exc: 14 s = f.read() 15 print s 16 finally: 17 f.close()