Path: csiph.com!usenet.pasdenom.info!news.franciliens.net!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'syntax': 0.04; 'subject:Python': 0.06; 'duplicate': 0.07; 'difference,': 0.09; 'happens.': 0.09; 'subtle': 0.09; 'python': 0.11; 'windows': 0.15; '"python': 0.16; '(something': 0.16; 'enough.': 0.16; 'expects': 0.16; 'ignoring': 0.16; 'ought': 0.16; 'soup': 0.16; 'subject: \n ': 0.16; 'subject:object': 0.16; 'traceback.': 0.16; 'folder': 0.16; 'wrote:': 0.18; 'typing': 0.19; 'command': 0.22; '>>>': 0.22; 'code,': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'directory.': 0.24; 'recognize': 0.24; 'header:In- Reply-To:1': 0.27; 'michael': 0.29; 'wondering': 0.29; 'am,': 0.29; "doesn't": 0.30; 'code': 0.31; 'directory,': 0.31; 'subject:that': 0.31; 'file': 0.32; 'text': 0.33; 'sense': 0.34; 'maybe': 0.34; 'subject:with': 0.35; 'problem.': 0.35; 'case,': 0.35; 'but': 0.35; 'there': 0.35; "didn't": 0.36; 'shows': 0.36; 'thanks': 0.36; 'being': 0.38; 'same.': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'called': 0.40; 'is.': 0.60; 'skip:n 30': 0.60; 'skip:o 30': 0.61; 'course': 0.61; "you're": 0.61; 'you.': 0.62; 'name': 0.63; 're:': 0.63; 'more': 0.64; 'dear': 0.65; '30,': 0.65; 'worth': 0.66; 'close': 0.67; 'prompt': 0.68; 'received:74.208': 0.68; 'therefore': 0.72; 'obvious': 0.74; '2.8': 0.84; 'here)': 0.84; 'pasting': 0.84; 'subject:made': 0.84; 'instructed': 0.95 Date: Sun, 04 Jan 2015 09:14:52 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: python-list@python.org 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:luq1AfWMR+y9cP2mEtB1AQo155zaSabUfnQ8FpbTciC sIXZn9JTtjo7/qEeLX0qnC6jHemISqOxjzy5BeFxhg683sPeC9 myVNHM11ipni80c5AdR1Qhtlsp2l1/5kkQIMrUf1Wvga8+NOkg UdHsHCtVKal7J3yrjMTABhbKezO2BKIMPH1ahcGHx5IiW6a2hs y5fYadiS0tSC0533pv9Ij0I5eucWUeF+qbmgjJCccFaSLbbYKA tZzfMYwJAU57PdQlN7hVFMNZqsFsSpN7DSjVvAM7JudetdT6no 1P9Ge1CHJl4olpcp80/AaRTrjhlzCzugr2k8U7h3fei8kw3vCe gFD9O937jnJZ6eQmQ6IE= X-UI-Out-Filterresults: notjunk:1; X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1420380898 news.xs4all.nl 2977 [2001:888:2000:d::a6]:42718 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83207 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