import from containing folder

Simon Forman rogue_pedro at yahoo.com
Wed Jul 26 13:54:59 EDT 2006


David Isaac wrote:
> Alan wrote:
> > I do not want to make any assumptions about
> > this particular package being on sys.path.
> > (I want a relative import, but cannot assume 2.5.)
>
>
> I should mention that to get around this I have
> been using
> sys.path.append(os.path.split(sys.argv[0])[0])
> in the script I care most about.  It works,
> but seems like a hack.
>
> Thanks,
> Alan Isaac

Hack or not, that's what I would do.  In fact I have done that.  I hope
if there's a better way that someone will post it here.  ;-)

Peace,
~Simon




More information about the Python-list mailing list