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


Groups > comp.lang.python > #71595

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

Newsgroups comp.lang.python
Date 2014-05-15 05:17 -0700
References (12 earlier) <a187e566-50b9-40d7-b8f1-b10c51dec591@googlegroups.com> <CALwzidnKJ6TMn4TiEeZr0NY20KKLj-QwtH910mJN8FGwBW05zw@mail.gmail.com> <mailman.10020.1400096224.18130.python-list@python.org> <167bfe35-c36b-4d9d-8bd3-810015b24af6@googlegroups.com> <e24f1d40-3f1a-42f7-9650-afffa4855754@googlegroups.com>
Message-ID <d8f316d0-a471-4aa7-91c1-f7f69052f2fe@googlegroups.com> (permalink)
Subject Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.
From Rustom Mody <rustompmody@gmail.com>

Show all headers | View raw


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)
> 
> File"C:\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 :-

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


Thread

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

csiph-web