Two import questions in Python 3.0

Kay Schluehr kay.schluehr at gmx.net
Sat Jan 24 10:37:21 CET 2009


On 24 Jan., 09:21, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:

> If you run A.py as a script, it does not "know" it lives inside a package.
> You must *import* A for it to become aware of the package.
> Also, the directory containing the script comes earlier than PYTHONPATH
> entries in sys.path -- so watch for that case too.

Thanks, yes. I always make the same error thinking that a directory
with the ritual __init__ file is actually a package ( as some kind of
platonic entity ), something that is more obvious to me than it is to
the runtime. The relative import semantics introduced with Python 2.5
has made the error just visible that was hidden to me for about a
decade. Shit.



More information about the Python-list mailing list