On 5/11/2014 3:17 PM, Chris Angelico wrote:
On Mon, May 12, 2014 at 5:05 AM, Simon Evans <musicalhack...@yahoo.co.uk> 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
<class 'bs4.BeautifulSoup'>

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to