Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #110038 > unrolled thread

Re - Contradictory error messages in Python 3.4 - standard library issue!

Started byHarrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au>
First post2016-06-17 08:31 +1000
Last post2016-06-16 16:03 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re - Contradictory error messages in Python 3.4 - standard library issue! Harrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au> - 2016-06-17 08:31 +1000
    Re: Re - Contradictory error messages in Python 3.4 - standard library issue! Ned Batchelder <ned@nedbatchelder.com> - 2016-06-16 16:03 -0700

#110038 — Re - Contradictory error messages in Python 3.4 - standard library issue!

FromHarrison Chudleigh <harrison.chudleigh1@education.nsw.gov.au>
Date2016-06-17 08:31 +1000
SubjectRe - Contradictory error messages in Python 3.4 - standard library issue!
Message-ID<mailman.97.1466116754.2288.python-list@python.org>
Sorry! I was trying to indent a line and accidentally sent only half of the
message.

As I was saying, I changed the line and reran the program. However, this
produced another group of error messages. One was -
File
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py",
line 438, in open
    encoding, lines = detect_encoding(buffer.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 bytes or a tuple of bytes, not str.
So, first the interpreter says startswith() takes strings, now it says it
takes bytes? What should the module be doing?
This is an error with the standard library of Python 3.4.1, Mac OS X.
*******************************************************************************
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.

[toc] | [next] | [standalone]


#110039

FromNed Batchelder <ned@nedbatchelder.com>
Date2016-06-16 16:03 -0700
Message-ID<2e631b7f-58b3-46b3-a07a-9730d0aa16f9@googlegroups.com>
In reply to#110038
On Thursday, June 16, 2016 at 6:39:27 PM UTC-4, Harrison Chudleigh wrote:
> Sorry! I was trying to indent a line and accidentally sent only half of the
> message.
> 
> As I was saying, I changed the line and reran the program. However, this
> produced another group of error messages. One was -
> File
> "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tokenize.py",
> line 438, in open
>     encoding, lines = detect_encoding(buffer.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 bytes or a tuple of bytes, not str.
> So, first the interpreter says startswith() takes strings, now it says it
> takes bytes? What should the module be doing?
> This is an error with the standard library of Python 3.4.1, Mac OS X.

You shouldn't have to edit the stdlib files to get your program to work.
It sounds like you are using values with the tokenize module that it isn't
expecting. Can you show your code?

--Ned.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web