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


Groups > comp.lang.python > #85408

Re: Python 3 and the requests library

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'python.': 0.02; 'scripts': 0.03; 'subject:Python': 0.06; 'python': 0.11; 'subject:library': 0.16; 'subject:requests': 0.16; 'tokenize': 0.16; 'top-level': 0.16; 'wrote:': 0.18; 'library': 0.18; 'module': 0.19; 'feb': 0.22; 'appears': 0.22; 'import': 0.22; 'issue.': 0.22; 'mon,': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'absolute': 0.30; 'message-id:@mail.gmail.com': 0.30; 'this.': 0.32; 'brian': 0.33; 'subject:the': 0.34; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'library.': 0.36; 'thank': 0.38; 'problems': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'ian': 0.60; "you're": 0.61; 'first': 0.61; 'happen': 0.63; 'billing': 0.74; '2015': 0.84; 'shadow': 0.84; 'whereas': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=U/WmEH4JMArv/px4eqp/a/xKB4g3FkKISAJvaPDprAU=; b=sYEVAnsEUAQrd+eUElSNh3ShqNATnid7Wf6nnjsv1WbjKwYCPTlsXoolwfHTleFo+b 9q3RlAhOZafrLg74hNKCvgjt8vGnSjsLaBajjdwwOakYkNADlHtCFu2XkozkuFd/scxK nGRKk63ARW7XY6vt/ijDMcyDmfDJjydtGuDhGDlFfVkmRrpsEwrlP2VwhEj17y7UnZhN wuwWeo9gmPkmYyLdvCr9aYKIMYdvMR34xWnl2s/bE1Rowf2+kJfpTIZD3YlmSXwFpX51 NG3a930wIB10wpYhjV64pFp6QtqMjdoZBs3YOOjMEh74Nhz1BhI2LH2/3vf+QW8ArtD6 vOsw==
X-Received by 10.68.218.196 with SMTP id pi4mr33053576pbc.124.1423521783386; Mon, 09 Feb 2015 14:43:03 -0800 (PST)
MIME-Version 1.0
In-Reply-To <d6b8b366-d6a2-4929-8e27-406b626e953d@googlegroups.com>
References <9b2a1b9d-4f1b-4786-a3a6-2d414074da6f@googlegroups.com> <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 Mon, 9 Feb 2015 15:42:23 -0700
Subject Re: Python 3 and the requests library
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18581.1423521786.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1423521786 news.xs4all.nl 2870 [2001:888:2000:d::a6]:50799
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85408

Show key headers only | 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