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


Groups > comp.lang.python > #71256 > unrolled thread

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

Started bySimon Evans <musicalhacksaw@yahoo.co.uk>
First post2014-05-10 09:58 -0700
Last post2014-05-12 09:23 -0700
Articles 20 on this page of 42 — 9 participants

Back to article view | Back to comp.lang.python


Contents

  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

Page 1 of 3  [1] 2 3  Next page →


#71256 — How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-10 09:58 -0700
SubjectHow do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.
Message-ID<10313d81-01f2-48ed-951c-a5a6cccee65e@googlegroups.com>
I am new to Python, but my main interest is to use it to Webscrape. I have downloaded Beautiful Soup, and have followed the instruction in the 'Getting Started with Beautiful Soup' book, but my Python installations keep returning errors, so I can't get started. I have unzipped Beautiful Soup to a folder of the same name on my C drive, in accordance with the first two steps of page 12 of the aforementioned publication, but proceeding to navigate to the program as in step three, re: "Open up the command line prompt and navigate to the folder where you have unzipped the folder as follows:
cd Beautiful Soup
python setup python install "

This returns on my Python 27 :
>>> cd Beautiful Soup
File "<stdin>",line 1
cd Beautiful Soup
           ^
SyntaxError: invalid syntax
>>>

also I get:
>>> cd Beautiful Soup
SyntaxError: invalid syntax
>>>

to my IDLE Python 2.7 version, same goes for the Python 3.4 installations. 
Hope someone can help. 
Thanks in advance.

[toc] | [next] | [standalone]


#71257

FromChris Angelico <rosuav@gmail.com>
Date2014-05-11 03:03 +1000
Message-ID<mailman.9854.1399741414.18130.python-list@python.org>
In reply to#71256
On Sun, May 11, 2014 at 2:58 AM, Simon Evans <musicalhacksaw@yahoo.co.uk> wrote:
> "Open up the command line prompt and navigate to the folder where you have unzipped the folder as follows:
> cd Beautiful Soup
> python setup python install "

This would be the operating system command line, not Python's
interactive mode. Since you refer to a C drive, I'm going to assume
Windows; you'll want to open up "Command Prompt", or cmd.exe, or
whatever name your version of Windows buries it under. (Microsoft does
not make it particularly easy on you.) Since you have a space in the
name, you'll need quotes:

cd "c:\Beautiful Soup"

Then proceed as per the instructions.

ChrisA

[toc] | [prev] | [next] | [standalone]


#71263

FromTerry Reedy <tjreedy@udel.edu>
Date2014-05-10 14:39 -0400
Message-ID<mailman.9859.1399747215.18130.python-list@python.org>
In reply to#71256
On 5/10/2014 1:03 PM, Chris Angelico wrote:
> On Sun, May 11, 2014 at 2:58 AM, Simon Evans <musicalhacksaw@yahoo.co.uk> wrote:
>> "Open up the command line prompt and navigate to the folder where you have unzipped the folder as follows:
>> cd Beautiful Soup
>> python setup python install "
>
> This would be the operating system command line, not Python's
> interactive mode. Since you refer to a C drive, I'm going to assume
> Windows; you'll want to open up "Command Prompt", or cmd.exe, or
> whatever name your version of Windows buries it under. (Microsoft does
> not make it particularly easy on you.)

On the All Programs / Start menu, look under Accessories. I have it 
pinned to my Win 7 task bar.

 > Since you have a space in the name, you'll need quotes:
>
> cd "c:\Beautiful Soup"

Not for Win 7, at least

C:\Users\Terry>cd \program files

C:\Program Files>

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#71277

FromChris Angelico <rosuav@gmail.com>
Date2014-05-11 09:23 +1000
Message-ID<mailman.9868.1399764243.18130.python-list@python.org>
In reply to#71256
On Sun, May 11, 2014 at 4:39 AM, Terry Reedy <tjreedy@udel.edu> wrote:
>> Since you have a space in the name, you'll need quotes:
>>
>>
>> cd "c:\Beautiful Soup"
>
>
> Not for Win 7, at least
>
> C:\Users\Terry>cd \program files
>
> C:\Program Files>

Huh, good to know.

Unfortunately, Windows leaves command-line parsing completely up to
the individual command/application, so some will need quotes, some
won't, and some will actually do very different things if you put an
argument in quotes (look at START and FIND). There is a broad
convention that spaces in file names get protected with quotes, though
(for instance, tab completion will put quotes around them), so it's
not complete chaos.

ChrisA

[toc] | [prev] | [next] | [standalone]


#71282

FromDave Angel <d@davea.name>
Date2014-05-10 22:16 -0400
Message-ID<mailman.9873.1399774615.18130.python-list@python.org>
In reply to#71256
On 05/10/2014 07:23 PM, Chris Angelico wrote:
>  There is a broad
> convention that spaces in file names get protected with quotes, though
> (for instance, tab completion will put quotes around them), so it's
> not complete chaos.
>

"Complete chaos" is a pretty good description, especially since MS 
decided to make the default directory paths for many things have 
embedded spaces in them.  And to change the rules from version to 
version of the OS.  And it's not just the cmd line that's inconsistent; 
  some exec function variants liberally parse unquoted names looking for 
some file that happens to match the first few 'words" of the string.

I once debugged a customer problem (without actually seeing the 
machine), and told tech support to ask him if he had a file in the root 
directory called "program.exe."  I turned out to be right, and the 
customer was sure I must have hacked into his machine.

There was a bug in our code (missing quotes), masked by the liberality 
of the function I mentioned, that wasn't visible till such a file existed.

The customer symptom?  Our code complained that the linker couldn't be 
found.

-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#71338

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-11 12:05 -0700
Message-ID<7a908d5e-1e0e-4828-a3e0-172df735e6c3@googlegroups.com>
In reply to#71256
Thank you everyone who replied, for your help. Using the command prompt console, it accepts the first line of code, but doesn't seem to accept the second line. I have altered it a little, but it is not having any of it, I quote my console input and output here, as it can probably explain things better than I :- 
--------------------------------------------------------------------------------

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atom>cd"c:\Beautiful Soup"
The filename, directory name, or volume label syntax is incorrect.

C:\Users\Intel Atom>cd "c:\Beautiful Soup"

c:\Beautiful Soup>python setup.py install.
  File "setup.py", line 22
    print "Unit tests have failed!"
                                  ^
SyntaxError: invalid syntax

c:\Beautiful Soup>python setup.py install"
  File "setup.py", line 22
    print "Unit tests have failed!"
                                  ^
SyntaxError: invalid syntax

c:\Beautiful Soup>
--------------------------------------------------------------------------------
I have tried writing "python setup.py install" 
ie putting the statement in inverted commas, but the console still seems to reject it  re:- 
--------------------------------------------------------------------------------
c:\Beautiful Soup>"python setup. py install"
'"python setup. py install"' is not recognized as an internal or external comman
d,
operable program or batch file.

c:\Beautiful Soup>

--------------------------------------------------------------------------------
Again I hope you python practitioners can help. I am only on page 12, and have another 99 pages to go, so can only hope it gets easier.

[toc] | [prev] | [next] | [standalone]


#71340

FromChris Angelico <rosuav@gmail.com>
Date2014-05-12 05:17 +1000
Message-ID<mailman.9894.1399835856.18130.python-list@python.org>
In reply to#71338
On Mon, May 12, 2014 at 5:05 AM, Simon Evans <musicalhacksaw@yahoo.co.uk> wrote:
> Thank you everyone who replied, for your help. Using the command prompt console, it accepts the first line of code, but doesn't seem to accept the second line. I have altered it a little, but it is not having any of it, I quote my console input and output here, as it can probably explain things better than I :-
> --------------------------------------------------------------------------------

Thank you. This sort of transcript does make it very easy to see
what's going on!

> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> C:\Users\Intel Atom>cd"c:\Beautiful Soup"
> The filename, directory name, or volume label syntax is incorrect.

Command line syntax is always to put a command first (one word), and
then its arguments (zero, one, or more words). You put quotes around a
logical word when it has spaces in it. So, for instance, "foo bar" is
one logical word. In this case, you omitted the space between the
command and its argument, so Windows couldn't handle it. [1]

> C:\Users\Intel Atom>cd "c:\Beautiful Soup"

And this is correct; you put quotes around the argument, and execute
the "cd" command with an argument of "c:\Beautiful Soup". It then
works, as is shown by the change of prompt in your subsequent lines.

> c:\Beautiful Soup>python setup.py install.
>   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.)

Hope that helps!

ChrisA
[1] Windows lets you be a bit sloppy; for instance, cd\ works without
a space between the command and the argument. (AFAIK this is true if
and only if the path name starts with a backslash.) But normally, you
separate command and argument(s) with a space.

[toc] | [prev] | [next] | [standalone]


#71342

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-11 13:03 -0700
Message-ID<51368e56-35ee-4120-aacd-c759b01a45e5@googlegroups.com>
In reply to#71340
Dear Chris Angelico,
Yes, you are right, I did install Python 3.4 as well as 2.7. I have removed Python 3.4, and input the code you suggested and it looks like it has installed properly, returning the following code:- 
--------------------------------------------------------------------------------
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atom>cd "c:\Beautiful Soup"

c:\Beautiful Soup>c:\Python27\python setup.py install
running install
running build
running build_py
creating build
creating build\lib
copying BeautifulSoup.py -> build\lib
copying BeautifulSoupTests.py -> build\lib
running install_lib
copying build\lib\BeautifulSoup.py -> c:\Python27\Lib\site-packages
copying build\lib\BeautifulSoupTests.py -> c:\Python27\Lib\site-packages
byte-compiling c:\Python27\Lib\site-packages\BeautifulSoup.py to BeautifulSoup.p
yc
byte-compiling c:\Python27\Lib\site-packages\BeautifulSoupTests.py to BeautifulS
oupTests.pyc
running install_egg_info
Writing c:\Python27\Lib\site-packages\BeautifulSoup-3.2.1-py2.7.egg-info

c:\Beautiful Soup>
--------------------------------------------------------------------------------
Would that things were as straightforward as they are in the books, but anyway thank you much for your assistance, I'd still be typing the zillionth variation on the first line without your help. I don't doubt though that I will be coming unstuck in the not distant future. Until then, again thank you for your selfless help.

[toc] | [prev] | [next] | [standalone]


#71343

FromMRAB <python@mrabarnett.plus.com>
Date2014-05-11 21:19 +0100
Message-ID<mailman.9895.1399839577.18130.python-list@python.org>
In reply to#71342
On 2014-05-11 21:03, Simon Evans wrote:
> Dear Chris Angelico,
> Yes, you are right, I did install Python 3.4 as well as 2.7. I have removed Python 3.4, and input the code you suggested and it looks like it has installed properly, returning the following code:-
> --------------------------------------------------------------------------------
> Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> C:\Users\Intel Atom>cd "c:\Beautiful Soup"
>
> c:\Beautiful Soup>c:\Python27\python setup.py install
> running install
> running build
> running build_py
> creating build
> creating build\lib
> copying BeautifulSoup.py -> build\lib
> copying BeautifulSoupTests.py -> build\lib
> running install_lib
> copying build\lib\BeautifulSoup.py -> c:\Python27\Lib\site-packages
> copying build\lib\BeautifulSoupTests.py -> c:\Python27\Lib\site-packages
> byte-compiling c:\Python27\Lib\site-packages\BeautifulSoup.py to BeautifulSoup.p
> yc
> byte-compiling c:\Python27\Lib\site-packages\BeautifulSoupTests.py to BeautifulS
> oupTests.pyc
> running install_egg_info
> Writing c:\Python27\Lib\site-packages\BeautifulSoup-3.2.1-py2.7.egg-info
>
> c:\Beautiful Soup>
> --------------------------------------------------------------------------------
> Would that things were as straightforward as they are in the books, but anyway thank you much for your assistance, I'd still be typing the zillionth variation on the first line without your help. I don't doubt though that I will be coming unstuck in the not distant future. Until then, again thank you for your selfless help.
>
You didn't need to remove Python 3.4.

When you typed:

python setup.py install

it defaulted to Python 3.4, presumably because that was the last one
you installed.

You just needed to be explicit instead:

C:\Python27\python.exe setup.py install

[toc] | [prev] | [next] | [standalone]


#71344

FromTerry Reedy <tjreedy@udel.edu>
Date2014-05-11 16:31 -0400
Message-ID<mailman.9896.1399840324.18130.python-list@python.org>
In reply to#71338
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

[toc] | [prev] | [next] | [standalone]


#71345

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-11 15:03 -0700
Message-ID<1ade4a7c-833c-44eb-982a-3e17ccbc64b1@googlegroups.com>
In reply to#71344
I have downloaded Beautiful Soup 3, I am using Python 2.7. I understand from your message that I ought to use Python 2.6 or Python 3.4 with Beautiful Soup 4, the book I am using 'Getting Started with Beautiful Soup' is for Beautiful Soup 4. Therefore I gather I must re-download Beautiful Soup and get the 4 version, dispose of my Python 2.7 and reinstall Python 3.4. I am sure I can do this, but doesn't the above information suggest that the only Python grade left that might work with Beautiful Soup 3 would by Python 2.7 - which is the configuration I have at present, though I am not perfectly happy, as it is not taking code in the book (meant for BS4) such as the following on page 16 :

helloworld = "<p>Hello World</p>"

re:- 
--------------------------------------------------------------------------------
c:\Beautiful Soup>helloworld = "<p>Hello World</p>"
'helloworld' is not recognized as an internal or external command,
operable program or batch file.
--------------------------------------------------------------------------------
I take it that this response is due to using code meant for BS4 with Python 2.6/ 3.4, rather than BS3 with Python 2.7 which is what I am currently using. If so I will change the configurations.

[toc] | [prev] | [next] | [standalone]


#71346

FromMRAB <python@mrabarnett.plus.com>
Date2014-05-11 23:10 +0100
Message-ID<mailman.9897.1399846243.18130.python-list@python.org>
In reply to#71345
On 2014-05-11 23:03, Simon Evans wrote:
> I have downloaded Beautiful Soup 3, I am using Python 2.7. I understand from your message that I ought to use Python 2.6 or Python 3.4 with Beautiful Soup 4, the book I am using 'Getting Started with Beautiful Soup' is for Beautiful Soup 4. Therefore I gather I must re-download Beautiful Soup and get the 4 version, dispose of my Python 2.7 and reinstall Python 3.4. I am sure I can do this, but doesn't the above information suggest that the only Python grade left that might work with Beautiful Soup 3 would by Python 2.7 - which is the configuration I have at present, though I am not perfectly happy, as it is not taking code in the book (meant for BS4) such as the following on page 16 :
>
> helloworld = "<p>Hello World</p>"
>
> re:-
> --------------------------------------------------------------------------------
> c:\Beautiful Soup>helloworld = "<p>Hello World</p>"
> 'helloworld' is not recognized as an internal or external command,
> operable program or batch file.
> --------------------------------------------------------------------------------
> I take it that this response is due to using code meant for BS4 with Python 2.6/ 3.4, rather than BS3 with Python 2.7 which is what I am currently using. If so I will change the configurations.
>
That's the Windows command prompt, not the Python command prompt.

[toc] | [prev] | [next] | [standalone]


#71349

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-11 16:19 -0700
Message-ID<7b33a525-58ee-4009-94c4-f9ed69eb3af0@googlegroups.com>
In reply to#71346
Yeah well at no point does the book say to start inputting the code mentioned in Python command prompt rather than the Windows command prompt, but thank you for your guidance anyway. 
I have downloaded the latest version of Beautiful Soup 4, but am again facing problems with the second line of code, re:-
------------------------------------------------------------------------------- 
 Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atom>cd "c:\Beautiful Soup"

c:\Beautiful Soup>c:\Python27\python setup.py install
c:\Python27\python: can't open file 'setup.py': [Errno 2] No such file or direct
ory
--------------------------------------------------------------------------------
though that was the code I used before which installed okay see above). Can anyone tell me where I am going wrong ? Thanks.  

[toc] | [prev] | [next] | [standalone]


#71350

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-11 16:22 -0700
Message-ID<f77417ce-4c50-432e-b615-cf9867c1b60a@googlegroups.com>
In reply to#71349
On Monday, May 12, 2014 12:19:24 AM UTC+1, Simon Evans wrote:
> Yeah well at no point does the book say to start inputting the code mentioned in Python command prompt rather than the Windows command prompt, but thank you for your guidance anyway. 
> 
> I have downloaded the latest version of Beautiful Soup 4, but am again facing problems with the second line of code, re:-
> 
> ------------------------------------------------------------------------------- 
> 
>  Microsoft Windows [Version 6.1.7601]
> 
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
> 
> 
> 
> C:\Users\Intel Atom>cd "c:\Beautiful Soup"
> 
> 
> 
> c:\Beautiful Soup>c:\Python27\python setup.py install
> 
> c:\Python27\python: can't open file 'setup.py': [Errno 2] No such file or direct
> 
> ory
> 
> --------------------------------------------------------------------------------
> 
> though that was the code I used before which installed okay see above). Can anyone tell me where I am going wrong ? Thanks.
Oh I think I see - I should be using Python 3.4 now, with BS4 ?  

[toc] | [prev] | [next] | [standalone]


#71351

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-11 16:37 -0700
Message-ID<6913d181-8a7a-457d-a55f-63557b399d9f@googlegroups.com>
In reply to#71350
- but wait a moment 'BeautifulSoup4 works with 2.6+ and 3.x'(Terry Reedy) - doesn't 2.6 + = 2.7, which is what I'm using with BeautifulSoup4.  

[toc] | [prev] | [next] | [standalone]


#71353

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-05-11 17:47 -0600
Message-ID<mailman.9898.1399852081.18130.python-list@python.org>
In reply to#71349
On Sun, May 11, 2014 at 5:19 PM, Simon Evans <musicalhacksaw@yahoo.co.uk> wrote:
> Yeah well at no point does the book say to start inputting the code mentioned in Python command prompt rather than the Windows command prompt, but thank you for your guidance anyway.
> I have downloaded the latest version of Beautiful Soup 4, but am again facing problems with the second line of code, re:-
> -------------------------------------------------------------------------------
>  Microsoft Windows [Version 6.1.7601]
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> C:\Users\Intel Atom>cd "c:\Beautiful Soup"
>
> c:\Beautiful Soup>c:\Python27\python setup.py install
> c:\Python27\python: can't open file 'setup.py': [Errno 2] No such file or direct
> ory
> --------------------------------------------------------------------------------
> though that was the code I used before which installed okay see above). Can anyone tell me where I am going wrong ? Thanks.

The error message is telling you that the file setup.py that you're
trying to run is missing.  That would seem to indicate that Beautiful
Soup hasn't been downloaded or unzipped correctly.  What do you have
in the Beautiful Soup directory?

Also, use Python 3.4 as Terry Reedy suggested, unless the book is
using 2.7 in which case you should probably use the same version as
the book.

[toc] | [prev] | [next] | [standalone]


#71393

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-12 09:35 -0700
Message-ID<d40dcc5b-62d8-4354-b22e-d892f5a4c66f@googlegroups.com>
In reply to#71353
Dear Ian, 
The book does recommend to use Python 2.7 (see bottom line of page 10).
The book also recommends to use Beautiful Soup 4. 
You are right that in that I have placed the unzipped BS4 folder within a folder, and I therefore removed the contents of the inner folder and transferred them to the outer folder. 
The console now can access the contents of the Beautiful Soup folder, but it is still having problems with it as the last output to my console demonstrates :


Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atom>cd "c:\Beautiful Soup"

c:\Beautiful Soup>c:\Python27\python setup.py install
running install
running build
running build_py
error: package directory 'bs4' does not exist

c:\Beautiful Soup>

[toc] | [prev] | [next] | [standalone]


#71399

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-12 12:17 -0700
Message-ID<0f370792-1a98-4bb5-84e8-f0277bac4bed@googlegroups.com>
In reply to#71393
I did download the latest version of Beautiful Soup 4 from the download site, as the book suggested. 

[toc] | [prev] | [next] | [standalone]


#71403

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-05-12 16:54 -0600
Message-ID<mailman.9922.1399935297.18130.python-list@python.org>
In reply to#71393
On Mon, May 12, 2014 at 10:35 AM, Simon Evans
<musicalhacksaw@yahoo.co.uk> wrote:
> Dear Ian,
> The book does recommend to use Python 2.7 (see bottom line of page 10).
> The book also recommends to use Beautiful Soup 4.
> You are right that in that I have placed the unzipped BS4 folder within a folder, and I therefore removed the contents of the inner folder and transferred them to the outer folder.
> The console now can access the contents of the Beautiful Soup folder, but it is still having problems with it as the last output to my console demonstrates :
>
>
> Microsoft Windows [Version 6.1.7601]
>
> Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>
> C:\Users\Intel Atom>cd "c:\Beautiful Soup"
>
> c:\Beautiful Soup>c:\Python27\python setup.py install
> running install
> running build
> running build_py
> error: package directory 'bs4' does not exist

In the same folder where setup.py is, there should be a bs4 folder.
You might want to just wipe your Beautiful Soup directory and do a
clean unzip.

[toc] | [prev] | [next] | [standalone]


#71475

FromSimon Evans <musicalhacksaw@yahoo.co.uk>
Date2014-05-13 04:52 -0700
Message-ID<ece4439d-b5fd-469e-821a-6747be631e45@googlegroups.com>
In reply to#71403
I have removed the original Beautiful Soup 4 download, that I had unzipped to my Beautiful Soup directory on the C drive. 
I downloaded the latest version of Beautiful Soup 4 from the Crummy site. 
I unzipped it, and removed the contents of the unzipped directory and placed contents in my Beautiful Soup directory, and again had the same output to my console re: 
--------------------------------------------------------------------------------
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atom>cd "c:\Beautiful Soup"

c:\Beautiful Soup>c:\Python27\python setup.py install

c:\Beautiful Soup>
-------------------------------------------------------------------------------
I have made a note of all the contents of the downloaded and unzipped BS4,ie the contents of my Beautiful Soup folder on the C drive, which is as follows:
-------------------------------------------------------------------------------
running install
running build
running build_py
error: package directory 'bs4' does not existinit
_html5lib
_htmlparser
_lxml
6.1
AUTHORS
conf
COPYING
dammit
demonstration_markup
element
index.rst
Makefile
NEWS
PGK-INFO
README
setup
test_builder_registry
test_docs
test_html5lib
test_htmlparser
text_lxml
test_soup
test_tree
testing
TODO
--------------------------------------------------------------------------------
I can see no bs4 folder within the contents.
 I can not see any setup.py file either, but this is how I downloaded it.
I am only following instructions as suggested.
I do not understand why it is not working.
I hope someone can direct me in the right direction, as I seem to be stuck, and I don't think it has much bearing on my fluency or lack of it with Python. 

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.lang.python


csiph-web