Importing module PIL vs beautifulSoup.

Duncan Booth duncan.booth at invalid.invalid
Wed Jun 18 19:18:08 CEST 2008


bsagert at gmail.com wrote:

> I downloaded BeautifulSoup.py from
> http://www.crummy.com/software/BeautifulSoup/ and being a n00bie, I
> just placed it in my Windows c:\python25\lib\ file. When I type
> "import beautifulsoup" from the interactive prompt it works like a
> charm. This seemed too easy in retrospect. 

It might be better if you put the file in \python25\lib\site-packages\
The same import will still work, but you probably want to avoid putting 
non-core files directly in \python25\lib.

Also, it sounds like you renamed the file: "import beautifulsoup" should 
fail (the file is supposed to be called BeautifulSoup.py). If you want to 
be able to install other software which has been written to use 
BeautifulSoup you'll need to make sure the case of the filename is correct.

> 
> Then I downloaded the PIL (Python Imaging Library) module from
> http://www.pythonware.com/products/pil/. Instead of a simple file that
> BeautifulSoup sent me, PIL is an .exe that installed itself in c:
> \python25\lib\site-packages\PIL\. However it won't load by typing
> "import pil".
> 
> I know I am supposed to RTFM, but a Google search has not led to the
> holy grail that Monty Python found. I realize that PIL is a package as
> opposed to a simple script (and it does not include a readme file).
> Thanks in advance for any help.
> 

Did you try "import PIL"? All module and package names in Python are case 
sensitive.



More information about the Python-list mailing list