On Tue, May 13, 2008 at 11:16 PM, <[EMAIL PROTECTED]> wrote:
> On May 13, 6:06 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > En Tue, 13 May 2008 07:30:44 -0300, Mike <[EMAIL PROTECTED]> 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- Hide quoted text - > > > > - Show quoted text - > > > I've overlooked the fact there is no _init_.py, I was expecting it to behave as a package. I'll put the file in my current directory as you suggested. Thanks for the explanation, it was very helpful and much appreciated.
-- http://mail.python.org/mailman/listinfo/python-list