relative import broken?

Alan Isaac aisaac at american.edu
Sun Apr 29 14:54:32 EDT 2007


"Alex Martelli" <aleax at mac.com> wrote in message
news:1hxa9x3.c0unyd1jw7vu9N%aleax at mac.com...
> If you're running test1.py as your main module, then it's not part of a
> package, so the relative import should indeed fail as you mention.

So if I understand you,
 in a package, any module that I wish
to make available for execution as a script
(in the usual way, with a main function)
cannot have any relative imports.
Is this right?  What is the reason for
this restriction?  (And where is it
documented?)

Thank you,
Alan Isaac





More information about the Python-list mailing list