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


Groups > comp.lang.python > #85408

Re: Python 3 and the requests library

References (1 earlier) <96003963-8ca1-4b62-811d-05d6f6a5709d@googlegroups.com> <mailman.18576.1423512729.18130.python-list@python.org> <97b23ac0-c363-43d0-815e-198354d39c58@googlegroups.com> <mailman.18578.1423515534.18130.python-list@python.org> <d6b8b366-d6a2-4929-8e27-406b626e953d@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2015-02-09 15:42 -0700
Subject Re: Python 3 and the requests library
Newsgroups comp.lang.python
Message-ID <mailman.18581.1423521786.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Feb 9, 2015 at 2:37 PM, Brian <brian.from.fl@gmail.com> wrote:
> Thank you, Ian and Zack! That was exactly the issue. Apparently, having a token.py script (one of my first Python 2 scripts to get an authorization token from a billing server) is OK for Python 2 but breaks Python 3.

Local modules that have the same absolute module path as standard
library modules will cause problems in either version of Python. I
think it's unfortunate that Python files that happen to live in the
same directory as the main script automatically get treated as
top-level modules that shadow the standard library. You're not the
first person to be confused by this.

It appears that the reason this works for you in Python 2 and not in
Python 3 is because the linecache module doesn't import tokenize in
Python 2, whereas it does in Python 3. If you had tried to import
tokenize directly in Python 2 then I expect you'd have the same
problem.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python 3 and the requests library Brian <brian.from.fl@gmail.com> - 2015-02-09 10:11 -0800
  Re: Python 3 and the requests library Brian <brian.from.fl@gmail.com> - 2015-02-09 11:20 -0800
    Re: Python 3 and the requests library Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-02-09 14:11 -0600
      Re: Python 3 and the requests library Brian <brian.from.fl@gmail.com> - 2015-02-09 12:37 -0800
        Re: Python 3 and the requests library Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-09 13:58 -0700
          Re: Python 3 and the requests library Brian <brian.from.fl@gmail.com> - 2015-02-09 13:37 -0800
            Re: Python 3 and the requests library Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-09 15:42 -0700
        Re: Python 3 and the requests library Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-02-09 15:03 -0600

csiph-web