Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83207
| Date | 2015-01-04 09:14 -0500 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| Subject | Re: Python console rejects an object reference, having made an object with that reference as its name in previous line |
| References | <01937423-e700-4825-a502-568dcb2d5324@googlegroups.com> <c16ce690-c44d-4ace-b010-552794aa7461@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17373.1420380898.18130.python-list@python.org> (permalink) |
On 01/04/2015 07:49 AM, Simon Evans wrote:
> Dear Michael Torrie,
> Thanks for pointing that out to me re: it not being a syntax problem.
> The thing is there is a file called 'EcologicalPyramid.html'. I put it in a folder called 'Soup' as the text advised on page 28.
> For what its worth I also shifted the Windows Command Prompt to that folder (re: cd Soup)as instructed on page 30,
> and put a duplicate file of 'EcologicalPyramid.html' in the python 2.8 directory.
Never put any user files in the "python 2.8" directory, whatever that is.
> I therefore am wondering where I ought put this html file where the Python console will recognize it ?
Since your code expects it in the current directory, either change the
code, or make sure it IS in the current directory.
The only obvious thing I can see is that you didn't spell the name the
same. But since Windows makes the error of ignoring case, it ought to
be close enough. However, you're typing the name, not pasting it, so
maybe there's some other subtle difference, like you have more than one
Soup directory.
Try the following, from the cmd.exe prompt:
myprompt> cd Soup
myprompt> dir *.html
(something shows here)
myprompt> python
(something shows here)
>>> from bs4 import BeautifulSoup
>>> with open("ecologicalpyramid.html","r") as ecological_pyramid:
... soup= next(ecological_pyramid,"lxml")
... producer_entries = soup.find("ul")
...
and see what happens. Paste the whole thing into a message if it
doesn't make sense to you. And of course don't forget to include the
traceback.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Python console rejects an object reference, having made an object with that reference as its name in previous line Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-12-14 08:15 -0800
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Ned Batchelder <ned@nedbatchelder.com> - 2014-12-14 11:36 -0500
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-12-14 10:37 -0800
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-12-14 20:51 +0200
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Billy Earney <billy.earney@gmail.com> - 2014-12-14 10:43 -0600
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-12-14 15:21 -0800
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-12-15 11:36 +1100
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Chris Roy-Smith <chris_roysmith@internode.on.net> - 2014-12-15 13:32 +1100
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Chris Angelico <rosuav@gmail.com> - 2014-12-15 13:42 +1100
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-12-15 02:47 +0000
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Michael Torrie <torriem@gmail.com> - 2014-12-14 22:27 -0700
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Chris Angelico <rosuav@gmail.com> - 2014-12-15 16:32 +1100
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Michael Torrie <torriem@gmail.com> - 2014-12-14 22:38 -0700
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-12-14 23:51 -0600
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Chris Angelico <rosuav@gmail.com> - 2014-12-15 16:52 +1100
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Simon Evans <musicalhacksaw@yahoo.co.uk> - 2014-12-18 08:19 -0800
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Michael Torrie <torriem@gmail.com> - 2014-12-18 09:35 -0700
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Simon Evans <musicalhacksaw@yahoo.co.uk> - 2015-01-04 04:49 -0800
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-04 13:11 +0000
Re: Python console rejects an object reference, having made an object with that reference as its name in previous line Dave Angel <davea@davea.name> - 2015-01-04 09:14 -0500
csiph-web