feedparser

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue May 13 07:06:00 EDT 2008


En Tue, 13 May 2008 07:30:44 -0300, Mike <42flicks at gmail.com> escribió:

> I'm trying to use the feedparser module (http://www.feedparser.org/).
>
> Is it possible to use this without running the setup program?
>
> I don't see why not, seems like I'm missing something obvious.
>
> My directory structure is:
>
> myprogram.py
>     /feedparser
>         /feedparser.py
>
> I know I can install the module in the modules directory but would like  
> to
> avoid this for two reasons: I'm only using it for the one project so  
> would
> like to keep it seperate, and if I move to a shared host I may not be
> allowed to install additional modules (not sure if this is correct  
> though).

The easiest way would be to put the single module feedparser.py in the  
same directory as your program (I don't  completely get your reasons not  
to do that). OR put feedparser.py in some other directory that is already  
listed in sys.path. OR add the directory containing feedparser.py to  
sys.path, just at the beginning of your program.

> I've tried:
>
> import feedparser
>
> import feedparser.feedparser
>
> from feedparser import feedparser
>
> What am I doing wrong? :)

*IF* the directory 'feedparser' were a package (that is, if it contained a  
file __init__.py), then that last import statement would be valid. But I  
don't reccomend doing this; you're changing the module's environment.

-- 
Gabriel Genellina




More information about the Python-list mailing list