[Tutor] trouble with beautiful soup

Danny Yoo dyoo at hashcollision.org
Sat Dec 26 15:59:41 EST 2015


On Sat, Dec 26, 2015 at 3:23 AM, marcus lütolf
<marcus.luetolf at bluewin.ch> wrote:
> Hi Walter, dear pythonistas,
>
> thank you !
> replacing „beautifulsoup“ by „bs4“ in my code (2nd line) does not relieve the trace back I get.
>
>
>
> In my directory C:\Python27\Lib I find the folder „beautifulsoup4-4-4-1“ in first place and the file „setup.py“ further down
>
> Upon opening „beautifulsoup4-4-4-1“,  „bs4“ appears as another folder among others and some  .py files.
>
> (C:\Python27\Lib\beautifoulsoup4-4-4-1\bs4\)


Ah.  This looks incorrect.  It appears that somehow the contents of
the zip file was directly copied into Python27\Lib.  This will not
work because the directory layout structure of the zip file includes
much more than what Python needs.  The zip file is structurally
organized so that you need to follow a specific procedure to install
the library.


To be clear: you should *not* be trying to directly copy files into
Python27\Lib.  Trying to do it by hand is error-prone, as you are
finding.


Please respond to Alan Gauld's recent response, where he said:

    Which command line are you using? The pip command is not a python
command but a shell one. You need to run it from
the CMD prompt.

    Did you try that? and if so what exact message did you get? Can
you show us a cut n paste of the session please?


Please respond to this, because it is crucial to understand what you
have done.  I don't think you've actually followed the earlier
instructions to run 'python setup.py install' at the Windows command
prompt.



> 2 days ago I watched a youtube video about installing beautifulsoup. There, the bs4 folder appeared direct in the Lib folder :
>
> C:\Python27\Lib\bs4\.
>
> Could this cause my trouble ?

The structure here is what I would have expected.  I strongly suggest
you try reinstalling the bs4 library by carefully following the
installation instructions.


---

By the way, as a meta-comment: please try to refer with explicit
hyperlinks if you talk about an external resource such as a YouTube
video.  When you mention "I watched a YouTube video about ...", then
it's very helpful if you can mention the specific hyperlink to that
video.  Here is one reason why it's helpful: it allows one of us to
confirm your observation.  Perhaps you might have misunderstood what
the video was showing?

Without references, we're at the mercy of hearsay.  Misinterpreting
what we observe is a common mistake that all of us humans make.
(This is not limited just in the programming domain, of course.)
Rather than ignore that human weakness, we can and should try to
anticipate and compensate.  By pointing with references, we allow
others to confirm our observations independently.  This is why
references are so important.   Reference-friendly systems like the WWW
are under-appreciated treasures.

---


Hope that makes sense.  Good luck to you!


More information about the Tutor mailing list