[Tutor] import and unittest

Thomas Coopman thomas.coopman at gmail.com
Wed Jan 17 14:32:36 CET 2007

On 1/17/07, Kent Johnson <kent37 at tds.net> wrote:
> Thomas Coopman wrote:
> > When I run One.py from in the directory A, doesn't look python in it's
> > parent directory when it can't find the module?
> > And if that's not the case where and what should I add to the sys.path
> > variable?
> No, Python won't look in parent directories for imports. Try running
> One.py from the parent dir of M by typing
> > python M/A/One.py
> or add the parent dir of M to sys.path.
> Kent
> when I try to run it from the parent dir of M, I still get the error,
where and when should I add the the parent dir to sys.path?

when I try from M.A import One in a shell executed in the parent dir of M
than it works.

The thing is that I would like to run One.py from anywhere and not just from
that one directory.
Thomas Coopman
Thomas.coopman at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070117/a100bc35/attachment.html 

More information about the Tutor mailing list