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

2014-05-15 Thread Simon Evans
Dear Programmers,
I downloaded Peazip, which doesn't remove file/ folder hierarchy. I unzipped it 
and input the same code to the console and it installed Beautiful Soup 4 okay 
re:- 
-
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\Python27\python setup.py install
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\bs4
copying bs4\dammit.py - build\lib\bs4
copying bs4\element.py - build\lib\bs4
copying bs4\testing.py - build\lib\bs4
copying bs4\__init__.py - build\lib\bs4
creating build\lib\bs4\builder
copying bs4\builder\_html5lib.py - build\lib\bs4\builder
copying bs4\builder\_htmlparser.py - build\lib\bs4\builder
copying bs4\builder\_lxml.py - build\lib\bs4\builder
copying bs4\builder\__init__.py - build\lib\bs4\builder
creating build\lib\bs4\tests
copying bs4\tests\test_builder_registry.py - build\lib\bs4\tests
copying bs4\tests\test_docs.py - build\lib\bs4\tests
copying bs4\tests\test_html5lib.py - build\lib\bs4\tests
copying bs4\tests\test_htmlparser.py - build\lib\bs4\tests
copying bs4\tests\test_lxml.py - build\lib\bs4\tests
copying bs4\tests\test_soup.py - build\lib\bs4\tests
copying bs4\tests\test_tree.py - build\lib\bs4\tests
copying bs4\tests\__init__.py - build\lib\bs4\tests
running install_lib
creating c:\Python27\Lib\site-packages\bs4
creating c:\Python27\Lib\site-packages\bs4\builder
copying build\lib\bs4\builder\_html5lib.py - c:\Python27\Lib\site-packages\bs4\
builder
copying build\lib\bs4\builder\_htmlparser.py - c:\Python27\Lib\site-packages\bs
4\builder
copying build\lib\bs4\builder\_lxml.py - c:\Python27\Lib\site-packages\bs4\buil
der
copying build\lib\bs4\builder\__init__.py - c:\Python27\Lib\site-packages\bs4\b
uilder
copying build\lib\bs4\dammit.py - c:\Python27\Lib\site-packages\bs4
copying build\lib\bs4\element.py - c:\Python27\Lib\site-packages\bs4
copying build\lib\bs4\testing.py - c:\Python27\Lib\site-packages\bs4
creating c:\Python27\Lib\site-packages\bs4\tests
copying build\lib\bs4\tests\test_builder_registry.py - c:\Python27\Lib\site-pac
kages\bs4\tests
copying build\lib\bs4\tests\test_docs.py - c:\Python27\Lib\site-packages\bs4\te
sts
copying build\lib\bs4\tests\test_html5lib.py - c:\Python27\Lib\site-packages\bs
4\tests
copying build\lib\bs4\tests\test_htmlparser.py - c:\Python27\Lib\site-packages\
bs4\tests
copying build\lib\bs4\tests\test_lxml.py - c:\Python27\Lib\site-packages\bs4\te
sts
copying build\lib\bs4\tests\test_soup.py - c:\Python27\Lib\site-packages\bs4\te
sts
copying build\lib\bs4\tests\test_tree.py - c:\Python27\Lib\site-packages\bs4\te
sts
copying build\lib\bs4\tests\__init__.py - c:\Python27\Lib\site-packages\bs4\tes
ts
copying build\lib\bs4\__init__.py - c:\Python27\Lib\site-packages\bs4
byte-compiling c:\Python27\Lib\site-packages\bs4\builder\_html5lib.py to _html5l
ib.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\builder\_htmlparser.py to _html
parser.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\builder\_lxml.py to _lxml.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\builder\__init__.py to __init__
.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\dammit.py to dammit.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\element.py to element.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\testing.py to testing.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_builder_registry.py
to test_builder_registry.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_docs.py to test_docs
.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_html5lib.py to test_
html5lib.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_htmlparser.py to tes
t_htmlparser.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_lxml.py to test_lxml
.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_soup.py to test_soup
.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\test_tree.py to test_tree
.pyc
byte-compiling c:\Python27\Lib\site-packages\bs4\tests\__init__.py to __init__.p
yc
byte-compiling c:\Python27\Lib\site-packages\bs4\__init__.py to __init__.pyc
running install_egg_info
Writing c:\Python27\Lib\site-packages\beautifulsoup4-4.1.0-py2.7.egg-info

c:\Beautiful Soup

Thank you for your thoughtful help, I am sure I will be needing more though, in 
the not too distant future. 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-15 Thread Simon Evans


Dear Programmers,
As anticipated, it has not been to long before I have encountered further 

difficulty. At the top of page 16 of 'Getting Started with Beautiful Soup it 

gives code to be input, whether to the Python or Windows command prompt I am 
not 

sure, but both seem to be resistant to it. I quote the response to the code 
below, 

the code input being :- 

helloworld = pHello World/p
soup_string = BeautifulSoup(helloworld)

to Windows Command prompt this gives :- 
--
SyntaxError: invalid syntax
 helloworld = pHelloWorld/p
 soup_string = BeautifulSoup(helloworld)
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'BeautifulSoup' is not defined
--
I have been told by one of the programmers, that I ought be inputting this to 
the 

Python command prompt (the book doesn't spacify), but that doesn't take either 

re:-
--
helloworld = pHelloWorld/p
soup_string = BeautifulSoup(helloworld)
Traceback (most recent call last):
File stdin, line 1, in module
NameError: name 'BeautifulSoup' is not defined

--
Looking at the bottom of page 16, there is more code for the inputting of, that 

again does not take to the Windows Command Prompt or the Python command prompt,
re:  import urllib2
 from bs4 import BeautifulSoup
 url = http://www.packtpub.com/books;
 page = urllib2.urlopen(url)
 soup_packtpage = BeautifulSoup(page)

returns to the Windows Command prompt:- 
--
import urllib2
Traceback (most recent call last):
  File stdin, line1, in module
ImportError: No module named 'urllib2'


--
returns to the Python command prompt :- 
--
 import urllib2
 from bs4 import BeautifulSoup
 url = http://www.packtpub.com/books;
 page = urllib2.urlopen(url)
Traceback (most recent call last):
File C\Python27\lib\urllib2.py,line 127, in urlopen
  return_opener.open(url, data, timeout)
File C:\Python27\lib\urllib2.py,line 410, in open
response = meth(req, response)
File C:\Pyton27\lib\urllib2.py, oine 523, in http_response
'http', request, response, code, msg, hdrs)
FileC:\Python27\lib\urllib2.py, line 448, in error
return self._call_chain(*args)
File C:/Python27/lib/urllib2.py,line 382, in _call_chain
result = func(*args)
File C:\Python27\lib\urllib2.py, line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, masg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
-
Anway I hope you can tell me what is amiss, there is no point in my proceeding 

with the book (about 111 pages all told) until I find out why it won't take. 
I realise I have been told to learn python in order to make things less 
painful, 

but I don't see why code written in the book does not take. 
Thank you for reading.





I thought I might as well include, so's you might be able to see where things 
are 

going astray. The Windows command prompt :- 



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


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

2014-05-15 Thread Simon Evans
Dear Programmers, I noticed a couple of typos in my previous message, so have 
now altered them thus :- 

Dear Programmers,
As anticipated, it has not been to long before I have encountered further 

difficulty. At the top of page 16 of 'Getting Started with Beautiful Soup it 

gives code to be input, whether to the Python or Windows command prompt I am 
not 

sure, but both seem to be resistant to it. I quote the response to the code 
below, 

the code input being :- 

helloworld = pHello World/p
soup_string = BeautifulSoup(helloworld)

to Windows Command prompt this gives :- 
--
SyntaxError: invalid syntax
 helloworld = pHelloWorld/p
 soup_string = BeautifulSoup(helloworld)
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'BeautifulSoup' is not defined
--
I have been told by one of the programmers, that I ought be inputting this to 
the 

Python command prompt (the book doesn't spacify), but that doesn't take either 

re:-
--
helloworld = pHelloWorld/p
soup_string = BeautifulSoup(helloworld)
Traceback (most recent call last):
File stdin, line 1, in module
NameError: name 'BeautifulSoup' is not defined

--
Looking at the bottom of page 16, there is more code for the inputting of, that 

again does not take to the Windows Command Prompt or the Python command prompt,
re:  import urllib2
 from bs4 import BeautifulSoup
 url = http://www.packtpub.com/books;
 page = urllib2.urlopen(url)
 soup_packtpage = BeautifulSoup(page)

returns to the Windows Command prompt:- 
--
import urllib2
Traceback (most recent call last):
  File stdin, line1, in module
ImportError: No module named 'urllib2'


--
returns to the Python command prompt :- 
--
 import urllib2
 from bs4 import BeautifulSoup
 url = http://www.packtpub.com/books;
 page = urllib2.urlopen(url)
Traceback (most recent call last):
File C\Python27\lib\urllib2.py,line 127, in urlopen
  return_opener.open(url, data, timeout)
File C:\Python27\lib\urllib2.py,line 410, in open
response = meth(req, response)
File C:\Python27\lib\urllib2.py, oine 523, in http_response
'http', request, response, code, msg, hdrs)
FileC:\Python27\lib\urllib2.py, line 448, in error
return self._call_chain(*args)
File C:/Python27/lib/urllib2.py,line 382, in _call_chain
result = func(*args)
File C:\Python27\lib\urllib2.py, line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, masg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
-
Anway I hope you can tell me what is amiss, there is no point in my proceeding 

with the book (about 111 pages all told) until I find out why it won't take. 
I realise I have been told to learn python in order to make things less 
painful, 

but I don't see why code written in the book does not take. 
Thank you for reading.








 


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


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

2014-05-15 Thread Dave Angel

On 05/15/2014 07:30 AM, Simon Evans wrote:

Dear Programmers, I noticed a couple of typos in my previous message, so have 
now altered them thus :-

Dear Programmers,
As anticipated, it has not been to long before I have encountered further

difficulty.


Your first thread was about getting Beautiful Soup installed and 
working.  If you can successfully import it, you're ready for a new 
thread, new subject line, etc.


Note the new thread's opener should be self-contained, meaning you 
should mention the environment (version of BS, version of Python, 
version of what OS), and your difficulty.


 At the top of page 16 of 'Getting Started with Beautiful Soup it

 gives code to be input, whether to the Python or Windows command 
prompt I am not




My guess is that the book is now describing what goes in a program, not 
at the command prompts.  A program is typically written in a text 
file, not at the interpreter prompt, though experimentation is certainly 
done there.


Once you have a program in a text file (usually with the extension .py), 
you run it at the OS terminal prompt by typing:

 python  myprogram.py





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


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

2014-05-15 Thread Rustom Mody
On Thursday, May 15, 2014 4:55:42 PM UTC+5:30, Simon Evans wrote:
 Dear Programmers,
 
 As anticipated, it has not been to long before I have encountered further 
 
 difficulty. At the top of page 16 of 'Getting Started with Beautiful Soup it 
 
 gives code to be input, whether to the Python or Windows command prompt I am 
 not 
 
 sure, but both seem to be resistant to it. I quote the response to the code 
 below, 

It was because I thought I saw such a mixup in your earlier posts that
I suggested you start with the python tutorial :-)
 Looking at the bottom of page 16, there is more code for the inputting of, 
 that 
 
 
 
 again does not take to the Windows Command Prompt or the Python command 
 prompt,
 
 re:  import urllib2
 
  from bs4 import BeautifulSoup

You probably need the above line
And you need to preceded the other lines at the python (not shell) prompt

On the whole it may be a good idea to put aside the book and just follow the 
quick start http://www.crummy.com/software/BeautifulSoup/bs4/doc/#quick-start

at the python prompt

 
  url = http://www.packtpub.com/books;
 
  page = urllib2.urlopen(url)
 
  soup_packtpage = BeautifulSoup(page)
 
 
 
 returns to the Windows Command prompt:- 
 
 --
 
 import urllib2
 
 Traceback (most recent call last):
 
   File stdin, line1, in module
 
 ImportError: No module named 'urllib2'
 
 
 
 
 
 --
 
 returns to the Python command prompt :- 
 
 --
 
  import urllib2
 
  from bs4 import BeautifulSoup
 
  url = http://www.packtpub.com/books;
 
  page = urllib2.urlopen(url)
 
 Traceback (most recent call last):
 
 File C\Python27\lib\urllib2.py,line 127, in urlopen
 
   return_opener.open(url, data, timeout)
 
 File C:\Python27\lib\urllib2.py,line 410, in open
 
 response = meth(req, response)
 
 File C:\Pyton27\lib\urllib2.py, oine 523, in http_response
 
 'http', request, response, code, msg, hdrs)
 
 FileC:\Python27\lib\urllib2.py, line 448, in error
 
 return self._call_chain(*args)
 
 File C:/Python27/lib/urllib2.py,line 382, in _call_chain
 
 result = func(*args)
 
 File C:\Python27\lib\urllib2.py, line 531, in http_error_default
 
 raise HTTPError(req.get_full_url(), code, masg, hdrs, fp)
 
 urllib2.HTTPError: HTTP Error 403: Forbidden
 
 -
 
 Anway I hope you can tell me what is amiss, there is no point in my 
 proceeding 
 
 
 
 with the book (about 111 pages all told) until I find out why it won't take. 
 
 I realise I have been told to learn python in order to make things less 
 painful, 
 
 
 
 but I don't see why code written in the book does not take. 
 
 Thank you for reading.
 
 
 
 
 
 
 
 
 
 
 
 I thought I might as well include, so's you might be able to see where things 
 are 
 
 
 
 going astray. The Windows command prompt :-

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


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

2014-05-14 Thread Simon Evans
I downloaded the get-pip.py file. I installed it to the same folder on my C 
drive as the Beautiful Soup one in which the Beautiful Soup 4 downloads was 
unzipped to. I changed directory to the folder on the Command Prompt, as you 
instructed in step 2. I input the code to the console you gave on step 3), that 
returned some code, as quoted below. I then input the code you gave on step 4) 
but Console seems to reject or not recognise 'pip' as a term. I am sure quoting 
the actual prompt response can explain things better than I :
---
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.


C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful Souppython get-pip.py
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pi
p-1.5.5-py2.py3-none-any.whl#md5=03a932d6f82a3887d8de1cdb837c87ed
Installing collected packages: pip
  Found existing installation: pip 1.5.4
Uninstalling pip:
  Successfully uninstalled pip
Successfully installed pip
Cleaning up...

c:\Beautiful Souppip install beautifulsoup4
'pip' is not recognized as an internal or external command,
operable program or batch file.

c:\Beautiful Soup

Perhaps I oughtn't have downloaded the pip file to the same directory as the 
Beautiful Soup ? I will have a try at transferring the file to another folder
and running the code you gave again. 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-14 Thread Simon Evans
I have input the above code by copy and pasting to the Idle python console, as 
the python 2.7 command prompt is fussy about the indentation on the eleventh 
line down, if I then indent it, it replies that the indentation is unnecessary 
of unexpected, and if I don't it says an indentation is expected. 
However when I get to the next lines of code - in the Idle prompt re:

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\Python27\python setup.py install

Again it does not recognise 'bs4'. I think having used 'Just unzip it' instead 
of 'WinZip' may have caused this problem, in the first place ,as when I looked 
at the WinZip version at a local net café, it did have a folder hierarchy, 
however I wanted, and still want to skimp the £25 fee for WinZip, which 
nowadays you can't seem to be able to do. I never asked for the darn files to 
be zipped, so why ought I pay to have them unzipped, being my contention.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-14 Thread Ian Kelly
On Wed, May 14, 2014 at 12:58 PM, Simon Evans
musicalhack...@yahoo.co.uk wrote:
 c:\Beautiful Souppip install beautifulsoup4
 'pip' is not recognized as an internal or external command,
 operable program or batch file.

 c:\Beautiful Soup
 
 Perhaps I oughtn't have downloaded the pip file to the same directory as the 
 Beautiful Soup ? I will have a try at transferring the file to another folder
 and running the code you gave again.

No, sounds like a path environment variable issue.  The python
executable is on your path, but the pip executable is not.  The
get-pip.py script should have installed it into C:\Python27\Scripts, I
think, so either add that directory to your path (you can find
instructions for this on the web) or just cd to that directory and run
the pip command from there.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-14 Thread Ian Kelly
On Wed, May 14, 2014 at 1:28 PM, Simon Evans  Again it does not
recognise 'bs4'. I think having used 'Just unzip it' instead of
'WinZip' may have caused this problem, in the first place ,as when I
looked at the WinZip version at a local net café, it did have a folder
hierarchy, however I wanted, and still want to skimp the £25 fee for
WinZip, which nowadays you can't seem to be able to do. I never asked
for the darn files to be zipped, so why ought I pay to have them
unzipped, being my contention.

I use 7-zip (www.7-zip.org), which is freely distributed and open source.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-14 Thread Chris Angelico
On Thu, May 15, 2014 at 5:33 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
 I use 7-zip (www.7-zip.org), which is freely distributed and open source.

You beat me to the punch. :) Was about to say the exact same thing, so
instead I'll second your recommendation.

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


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

2014-05-13 Thread Simon Evans
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 Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\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. 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-13 Thread Simon Evans
Dear Ian,  and other programmers, thank you for your advice. 
I am resending the last message because this twattish cut and paste facility on 
my computer has a knack of chopping off ones original message, I will try to 
convey the right message this time :  

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 Atomcd c:\Beautiful Soup 

c:\Beautiful Soupc:\Python27\python setup.py install 

running install
running build
running build_py
error: package directory 'bs4' does not exist


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. 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-13 Thread Mark Lawrence

On 13/05/2014 12:59, Simon Evans wrote:

I suggest that you follow the instructions here 
http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows 
to get pip, then let pip do the work for you as that's what it's 
designed for :)


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


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

2014-05-13 Thread MRAB

On 2014-05-13 12:59, Simon Evans wrote:

Dear Ian,  and other programmers, thank you for your advice.
I am resending the last message because this twattish cut and paste facility on 
my computer has a knack of chopping off ones original message, I will try to 
convey the right message this time :

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 Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\Python27\python setup.py install

running install
running build
running build_py
error: package directory 'bs4' does not exist


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.



I think I see your problem: you've unpacked everything into a single
folder instead of a folder hierarchy.

(It also looks like you have Explorer configured to hide the file
extensions. That's generally _not_ recommended.)


Try this:

#! python3.4
# -*- coding: utf-8 -*-
from os.path import splitext
import gzip
import tarfile

# The path of the downloaded file.
tar_gz_path = r'C:\beautifulsoup4-4.3.2.tar.gz'

# Unpack the .tar.gz file to a .tar file.
tar_path, ext = splitext(tar_gz_path)

with gzip.open(tar_gz_path, 'rb') as from_file:
with open(tar_path, 'wb') as to_file:
chunk = from_file.read()
to_file.write(chunk)

# Unpack the .tar file to a folder.
folder, ext = splitext(tar_path)

tar = tarfile.open(tar_path)
tar.extractall(folder)
tar.close()

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


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

2014-05-13 Thread Ian Kelly
On Tue, May 13, 2014 at 5:59 AM, Simon Evans musicalhack...@yahoo.co.uk wrote:
 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.

You do have a setup.py in there, but your Windows explorer is showing
it to you without the .py extension.  Something unusual is happening
with the download/extraction process though and you're missing the
correct folder structure.  If you take a look here, you can see what
you *should* have after unzipping:

http://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/files

This approach seems to be unproductive though, so I'm going to second
Mark's suggestion to just use pip:

1) Go to pip-installer.org and download the single file get-pip.py
2) Open a command prompt and cd to the folder you downloaded that file into.
3) python get-pip.py
4) pip install beautifulsoup4

And then you should finally be ready to get started.  Good luck!
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-13 Thread Mark Lawrence

On 13/05/2014 17:33, Ian Kelly wrote:

On Tue, May 13, 2014 at 5:59 AM, Simon Evans musicalhack...@yahoo.co.uk wrote:

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.


You do have a setup.py in there, but your Windows explorer is showing
it to you without the .py extension.  Something unusual is happening
with the download/extraction process though and you're missing the
correct folder structure.  If you take a look here, you can see what
you *should* have after unzipping:

http://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/files

This approach seems to be unproductive though, so I'm going to second
Mark's suggestion to just use pip:

1) Go to pip-installer.org and download the single file get-pip.py
2) Open a command prompt and cd to the folder you downloaded that file into.
3) python get-pip.py
4) pip install beautifulsoup4

And then you should finally be ready to get started.  Good luck!



To be fair Terry Reedy has suggested pip at least twice, I've just given 
another source of data on how to get pip in the first place.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


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

2014-05-12 Thread Simon Evans
Hi Ian, thank you for your help. 
Yes that is the book by Vineeth J Nair.
At the top of page 12, at step 1 it says :

1.Download the latest tarball from 
https://pypi.python.org/packages/source/b/beautifulsoup4/.

So yes, the version the book is dealing with is beautiful soup 4. 
I am using Pyhon 2.7, I have removed Python 3.4.
Also on the bottom of page 10, Mr Nair states:

Pick the path variagble and add the following section to the Path variable:

;C:\PythonXY for example C:\Python27

Which tells me that the Python version cited in the book must be 2.7

I downloaded beautiful soup 4 last night. I unzipped it with 'Just unzip it' to 
a folder I called Beautiful Soup, the same as I did with the previous beautiful 
soup download. The console return is as below, showing that I am now facing the 
same conundrum as yesterday, before changing my version of Beautiful Soup. re:

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

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful SoupBeautiful Soupc:\Python27\python setup.py install
'Beautiful' is not recognized as an internal or external command,
operable program or batch file.

c:\Beautiful Soup


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


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

2014-05-12 Thread Simon Evans
The version of Python the book seems to be referring to is 2.7, re: bottom of 
page 10-
'Pick the Path variable and add the following section to the Path variable: 
;C:\PythonXY for example C:\Python 27'

The version of Beautiful Soup seems to be Beautiful Soup 4 as at the top of 
page 12 it states:
'1.Download the latest tarball from 
https://pypi.python.org/packages/source/b/beautifulsoup4/.'

I have downloaded and unzipped to a folder called 'Beautiful Soup' on the C 
drive the Beautiful Soup 4 version. I am using the Python 2.7 console and IDLE, 
I have removed the 3.4 version. 

All the same I seem to be having difficulties again as console wont accept the 
code it did when it was the previous version of BS that I used yesterday. I 
realise I would not be having this problem if I proceeded to input the 'Hello 
World' code on the Python console, but as said, the text never specifically 
said 'change to Python 2.7 console'. I thought the problem was with the BS 
version and so changed it, but now can't even get as far as I had before 
changing it. Anyhow be that as it may, this is the console response to my input:

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

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful SoupBeautiful Soupc:\Python27\python setup.py install
'Beautiful' is not recognized as an internal or external command,
operable program or batch file.

c:\Beautiful Soup
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-12 Thread Simon Evans
Thank you for your advice. I did buy a book on Python, 'Hello Python' but the 
code in it wouldn't run, so I returned it to the shop for a refund. I am going 
to visit the local library to see if they have any books on Python. I am 
familiar with Java and Pascal, and looking at a few You tubes on the subject, 
thought it was not much different, and shares many of the oop concepts 
(variables, initializing, expressions, methods, and so on, but I realize there 
is no point in walking backwards in new territory.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-12 Thread Simon Evans
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 Atomcd c:\Beautiful Soup

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

c:\Beautiful Soup
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-12 Thread Simon Evans
I did download the latest version of Beautiful Soup 4 from the download site, 
as the book suggested. 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-12 Thread Ian Kelly
On Mon, May 12, 2014 at 10:35 AM, Simon Evans
musicalhack...@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 Atomcd c:\Beautiful Soup

 c:\Beautiful Soupc:\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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Simon Evans

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 Atomcdc:\Beautiful Soup
The filename, directory name, or volume label syntax is incorrect.

C:\Users\Intel Atomcd c:\Beautiful Soup

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

c:\Beautiful Souppython 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 Souppython 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Chris Angelico
On Mon, May 12, 2014 at 5:05 AM, Simon Evans musicalhack...@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 Atomcdc:\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 Atomcd 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 Souppython 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Simon Evans
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 Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread MRAB

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 Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\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

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


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

2014-05-11 Thread Terry Reedy

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 Souppython 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\Python34pip 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


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

2014-05-11 Thread Simon Evans
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 = pHello World/p

re:- 

c:\Beautiful Souphelloworld = pHello 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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread MRAB

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 = pHello World/p

re:-

c:\Beautiful Souphelloworld = pHello 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.

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


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

2014-05-11 Thread Simon Evans
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 Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\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.  
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Simon Evans
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 Atomcd c:\Beautiful Soup
 
 
 
 c:\Beautiful Soupc:\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 ?  

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


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

2014-05-11 Thread Simon Evans
- 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.  
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Ian Kelly
On Sun, May 11, 2014 at 5:19 PM, Simon Evans musicalhack...@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 Atomcd c:\Beautiful Soup

 c:\Beautiful Soupc:\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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Terry Reedy

On 5/11/2014 6:03 PM, 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.6or Python
3.4 with Beautiful Soup 4,


I wrote BeautifulSoup4 works with 2.6+ and 3.x..
'2.6+' means 2.6 or 2.7. '3.x' should mean 3.1 to 3.4 but the range 
might start later. It does not matter because you should download and 
use 3.4 unless you *really* need to use something earlier. But also note 
that Windows has no problem with multiple version of python installed in 
different pythonxy directories.


One of the things 3.4 does for you is make sure that pip is installed. 
It is now the more or less 'official' python package installer. To 
install BS4, do what the authors recommend on their web page

http://www.crummy.com/software/BeautifulSoup/
and what I did: 'pip install beautifulsoup4' in a python34 directory. It 
took me less than a minute, far less that it took you to report that 
doing something else did not work.


--
Terry Jan Reedy

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


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

2014-05-11 Thread Ian Kelly
On Sun, May 11, 2014 at 5:47 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
 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.

Following up on that, if this is the book you are using:
http://www.amazon.com/Getting-Started-Beautiful-Soup-Vineeth/dp/1783289554

then it says to use Python 2.7.5 or greater.  There is no indication
that the book is targeted at Python 3, and in fact I see at least one
line that won't work in Python 3 (import urllib2), so I definitely
recommend sticking with a 2.7 release.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-11 Thread Chris Angelico
On Mon, May 12, 2014 at 6:31 AM, Terry Reedy tjre...@udel.edu wrote:
 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:

Oh, I'm glad of that! But without digging into the details of BS, all
I could say for sure was that setup.py was expecting 2.x. :)

Sticking with 3.4 and upgrading to BS4 is a much better solution.

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


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

2014-05-11 Thread Rustom Mody
On Saturday, May 10, 2014 10:28:18 PM UTC+5:30, Simon Evans wrote:
 I am new to Python, but my main interest is to use it to Webscrape.

I guess you've moved on from this specific problem.
However here is some general advice:

To use beautiful soup you need to use python.
To use python you need to know python.
Some people spend months on that, or weeks or days.

Maybe you are clever and can reduce that to hours but not further :-)

So start with this
https://docs.python.org/2/tutorial/
or
https://docs.python.org/3.4/tutorial/

[depending on which python you need]

It may take a bit longer; but you will suffer less.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-10 Thread Simon Evans
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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-10 Thread Chris Angelico
On Sun, May 11, 2014 at 2:58 AM, Simon Evans musicalhack...@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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-10 Thread Terry Reedy

On 5/10/2014 1:03 PM, Chris Angelico wrote:

On Sun, May 11, 2014 at 2:58 AM, Simon Evans musicalhack...@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\Terrycd \program files

C:\Program Files

--
Terry Jan Reedy

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


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

2014-05-10 Thread Chris Angelico
On Sun, May 11, 2014 at 4:39 AM, Terry Reedy tjre...@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\Terrycd \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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-05-10 Thread Dave Angel

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
--
https://mail.python.org/mailman/listinfo/python-list