relative import broken?

Alan Isaac aisaac at american.edu
Tue May 1 16:25:39 EDT 2007


"Alex Martelli" <aleax at mac.com> wrote in message
news:1hxeg2v.1ct59rv3oyq87N%aleax at mac.com...
> I don't know of any "pretty" way -- I'd do it by path manipulation
> (finding mypackage from os.path.abspath(__file__) and inserting its
> _parent_ directory in sys.path).


Yes, that seems to be the standard solution.
I find it ugly.  Anyway, I suppose my question remains:
why are we constrained from solving this with
a relative import?  (And I suppose your answer will be:
well then, relative to *what*?  I am having trouble
seeing why that answer cannot be given a clear riposte.)

Thanks,
Alan





More information about the Python-list mailing list