Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'correct.': 0.07; 'python3': 0.07; 'filename': 0.09; 'imported': 0.09; 'python': 0.11; 'posted': 0.15; '__all__': 0.16; 'attribute.': 0.16; 'comparison:': 0.16; 'formally': 0.16; 'modules.': 0.16; 'skip:/ 70': 0.16; 'subject:library': 0.16; 'subject:requests': 0.16; 'tokenize': 0.16; 'followed': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; '(not': 0.18; 'library': 0.18; 'module': 0.19; 'seems': 0.21; 'feb': 0.22; 'appears': 0.22; 'example': 0.22; 'cc:addr:gmail.com': 0.22; 'to:name:python-list@python.org': 0.22; 'module,': 0.24; 'skip:l 30': 0.24; 'mon,': 0.24; 'versions': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'logging': 0.26; 'header:In-Reply-To:1': 0.27; 'installed': 0.27; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'skip:/ 80': 0.31; 'run': 0.32; 'brian': 0.33; 'actual': 0.34; 'subject:the': 0.34; 'problem': 0.35; 'except': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'version:': 0.36; 'shows': 0.36; 'should': 0.36; 'so,': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'here': 0.66; '2015': 0.84; '3.4': 0.84; 'precompiled': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=pnczryIhN3AfqWQef/XhAHA/72Kf9qRcNrBj0af/ExE=; b=soukTsZwxdy8Do8L0z2exLtEfmDUhZfmoPAhagi94mEtWkb7/Ah+wJUs1+W3s0Lb4J Al8qBGRKbLwic9LMbm/xas+q/CWvk3c2vjDvd8bGOA9Pk0ibjGIsaW7+E9UBUuClsnS9 tOasMI03Ni20MFrglzJQudi3HxkgmwIfZj7pqy6okIovlKt8E61GK04s87BzMQaB/tSc NNknwgbp2VLVZ4BDB6SLFmF8SWwkpPOhG/xHmkdtKb+r37kwVsMitIZ3WzngSio6iHKM 9OrfGqnsUdlPSv8wYeZE51toW26y/TRSvuyVZLis6AeM4AJlR9mMqRkRT411jgH9kbbj uVwg== X-Received: by 10.202.186.85 with SMTP id k82mr12456443oif.69.1423515833867; Mon, 09 Feb 2015 13:03:53 -0800 (PST) MIME-Version: 1.0 Sender: zachary.ware@gmail.com In-Reply-To: <97b23ac0-c363-43d0-815e-198354d39c58@googlegroups.com> References: <9b2a1b9d-4f1b-4786-a3a6-2d414074da6f@googlegroups.com> <96003963-8ca1-4b62-811d-05d6f6a5709d@googlegroups.com> <97b23ac0-c363-43d0-815e-198354d39c58@googlegroups.com> From: Zachary Ware Date: Mon, 9 Feb 2015 15:03:33 -0600 X-Google-Sender-Auth: UUXWmVD0VUYvUZeFCCx6N-IFTRQ Subject: Re: Python 3 and the requests library To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Cc: Brian X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423515836 news.xs4all.nl 2905 [2001:888:2000:d::a6]:53164 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:85404 On Mon, Feb 9, 2015 at 2:37 PM, Brian wrote: > Zach, > > Here is what I get on the Mac: > > $ python3 -c "import token;print(token.__file__)" > /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/token.py That looks correct. > Just for grins, I also ran it against the built-in Python 2.7.5 version: > > $ python -c "import token;print(token.__file__)" > /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/token.pyc > > The only difference seems to be that the 2.7.5 version has precompiled it. The 3.4 version is also precompiled, but __file__ gives the filename of the actual module (not the .pyc implementation detail). You can find precompiled token.py for 3.4 at /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/__pycache__/token.cpython-34.pyc > Then I followed your example but ran it against the logging module instead, as that > seems to be where the problem lies. Not so, the traceback you posted shows pretty clearly that the problem is in the tokenize module, where the token module it has imported does not have an __all__ attribute. > Again, for both version (broken 3 and working 2) as a comparison: > > $ python3 -c "import logging;print(logging.__file__)" > /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/logging/__init__.py This should have failed with the same traceback as your test2.py. > $ python -c "import logging;print(logging.__file__)" > /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.pyc > > But nothing is pointing to anything except what appears to be the formally installed > versions of these library modules. Try your test again. If it fails again, run my test again at the same prompt. -- Zach