Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'win32': 0.03; 'syntax': 0.04; '(of': 0.07; "subject:' ": 0.07; 'tries': 0.07; 'indicates': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'setup.py': 0.09; 'subject:2.7': 0.09; 'url:software': 0.09; 'subject:How': 0.10; 'python': 0.11; 'jan': 0.12; '2.7': 0.14; '"unit': 0.16; 'expecting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'skipping': 0.16; 'soup': 0.16; 'subject: \n ': 0.16; 'subject:access': 0.16; 'syntaxerror:': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'typing': 0.19; '>>>': 0.22; 'import': 0.22; 'tests': 0.22; 'print': 0.22; 'install': 0.23; 'installation': 0.23; 'header:User-Agent:1': 0.23; '2.x': 0.24; 'directory.': 0.24; 'mon,': 0.24; '---': 0.24; 'this:': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'installed': 0.27; 'chris': 0.29; 'am,': 0.29; 'skip:( 20': 0.30; '3.x': 0.31; 'default,': 0.31; 'doc': 0.31; 'go.': 0.31; 'implicit': 0.31; 'trivial': 0.31; 'file': 0.32; 'running': 0.33; 'skip:d 20': 0.34; 'there': 0.35; 'version': 0.36; 'installing': 0.36; 'entry': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; '12,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'received:173': 0.61; "you've": 0.63; '(that': 0.65; 'latest': 0.67; 'mar': 0.68; 'beautiful': 0.68; 'invalid': 0.68; 'default': 0.69; 'below.': 0.71; 'online': 0.71; '2014,': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Date: Sun, 11 May 2014 16:31:37 -0400 References: <10313d81-01f2-48ed-951c-a5a6cccee65e@googlegroups.com> <7a908d5e-1e0e-4828-a3e0-172df735e6c3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: 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: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399840324 news.xs4all.nl 2966 [2001:888:2000:d::a6]:46170 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71344 On 5/11/2014 3:17 PM, Chris Angelico wrote: > On Mon, May 12, 2014 at 5:05 AM, Simon Evans wrote: >> c:\Beautiful Soup>python setup.py install. There is no need for a standalone Beautiful Soup directory. See below. >> File "setup.py", line 22 >> print "Unit tests have failed!" >> ^ >> SyntaxError: invalid syntax > > This indicates that you've installed a 3.x version of Python as the > default, and setup.py is expecting a 2.x Python. Do you have multiple > Pythons installed? Try typing this: > > c:\Python27\python setup.py install > > (That will work only if you have Python 2.7 installed into the default > location.) Please do not advise people to unnecessarily downgrade to 2.7 ;-). Simon just needs the proper current version of BeautifulSoup. BeautifulSoup3 does not work with 3.x. BeautifulSoup4 works with 2.6+ and 3.x. http://www.crummy.com/software/BeautifulSoup/ Installation (of the latest version on PyPI) is trivial with 3.4: C:\Programs\Python34>pip install beautifulsoup4 Downloading/unpacking beautifulsoup4 Running setup.py (path:C:\Users\Terry\AppData\Local\Temp\pip_build_Terry\beautifulsoup4\setup.py) egg_info for package beautifulsoup4 Installing collected packages: beautifulsoup4 Running setup.py install for beautifulsoup4 Skipping implicit fixer: buffer Skipping implicit fixer: idioms Skipping implicit fixer: set_literal Skipping implicit fixer: ws_comma Successfully installed beautifulsoup4 Cleaning up... --- Adding the '4' is necessary as >pip install beautifulsoup tries to install beautifulsoup3 as a py3.4 package and that fails with the SyntaxError message Simon got. With '4', there is now an entry in lib/site-packages you are ready to go. Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] on win32 >>> from bs4 import BeautifulSoup # from the bs4 online doc >>> BeautifulSoup -- Terry Jan Reedy