Contradictory error messages in Python 3.4 - standard library issue!

Harrison Chudleigh harrison.chudleigh1 at education.nsw.gov.au
Thu Jun 16 18:25:20 EDT 2016


While working on a program, I ran into an error with the usage of the
module tokenize. The following message was displayed.
 File
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py",
line 467, in tokenize
    encoding, consumed = detect_encoding(readline)
  File
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py",
line 409, in detect_encoding
    if first.startswith(BOM_UTF8):
TypeError: startswith first arg must be str or a tuple of str, not bytes
Undaunted, I changed the error on line 409. The line then read:

if first.startswith(BOM_UTF8):
*******************************************************************************
This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender.


More information about the Python-list mailing list