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


Groups > comp.lang.python > #71344

Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

From Terry Reedy <tjreedy@udel.edu>
Subject Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.
Date 2014-05-11 16:31 -0400
References <10313d81-01f2-48ed-951c-a5a6cccee65e@googlegroups.com> <7a908d5e-1e0e-4828-a3e0-172df735e6c3@googlegroups.com> <CAPTjJmpjiGfXsuLCsPHL7FDTWFLmMqW27fzdcks9z_2_6pNrWg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.9896.1399840324.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 5/11/2014 3:17 PM, Chris Angelico wrote:
> On Mon, May 12, 2014 at 5:05 AM, Simon Evans <musicalhacksaw@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

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


Thread

How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-10 09:58 -0700
  Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Chris Angelico <rosuav@gmail.com> - 2014-05-11 03:03 +1000
  Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Terry Reedy <tjreedy@udel.edu> - 2014-05-10 14:39 -0400
  Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Chris Angelico <rosuav@gmail.com> - 2014-05-11 09:23 +1000
  Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Dave Angel <d@davea.name> - 2014-05-10 22:16 -0400
  Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-11 12:05 -0700
    Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Chris Angelico <rosuav@gmail.com> - 2014-05-12 05:17 +1000
      Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-11 13:03 -0700
        Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. MRAB <python@mrabarnett.plus.com> - 2014-05-11 21:19 +0100
    Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Terry Reedy <tjreedy@udel.edu> - 2014-05-11 16:31 -0400
      Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-11 15:03 -0700
        Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. MRAB <python@mrabarnett.plus.com> - 2014-05-11 23:10 +0100
          Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-11 16:19 -0700
            Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-11 16:22 -0700
              Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-11 16:37 -0700
            Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-11 17:47 -0600
              Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-12 09:35 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-12 12:17 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-12 16:54 -0600
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-13 04:52 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-13 04:59 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-13 14:23 +0100
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. MRAB <python@mrabarnett.plus.com> - 2014-05-13 15:48 +0100
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-14 12:28 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-14 13:33 -0600
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Chris Angelico <rosuav@gmail.com> - 2014-05-15 05:36 +1000
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-15 02:22 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-15 04:25 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-15 04:30 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Dave Angel <davea@davea.name> - 2014-05-15 08:12 -0400
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Rustom Mody <rustompmody@gmail.com> - 2014-05-15 05:17 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-13 10:33 -0600
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-14 11:58 -0700
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-14 13:30 -0600
                Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-13 20:08 +0100
            Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Ian Kelly <ian.g.kelly@gmail.com> - 2014-05-11 18:02 -0600
              Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-12 09:02 -0700
        Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Terry Reedy <tjreedy@udel.edu> - 2014-05-11 19:49 -0400
          Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-12 09:17 -0700
    Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Chris Angelico <rosuav@gmail.com> - 2014-05-12 11:40 +1000
  Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Rustom Mody <rustompmody@gmail.com> - 2014-05-11 19:47 -0700
    Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions. Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-05-12 09:23 -0700

csiph-web