[Tutor] import and unittest

Thomas Coopman thomas.coopman at gmail.com
Wed Jan 17 14:04:35 CET 2007


On 1/17/07, Kent Johnson <kent37 at tds.net> wrote:
>
> Thomas Coopman wrote:
> > Well I don't really
> > need the circular imports but I would like to know how to do the imports
> correct.
> >
> > Suppose that in the example that I showed only One needs Two.
> >
> > So then we have this:
> >
> > M/
> > __init__.py
> > A/
> > __init__.py
> > One.py
> > B/
> > __init__.py
> > Two.py
> >
> > One.py
> > #!/usr/bin/python
> >
> > from M.B import Two
> >
> >
> > when I run this I get this error:
> > ImportError: No Module named M.B
>
> Is the directory containing M in sys.path?
>
> Kent
>
>
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.pathvariable?


-- 
Thomas Coopman
Thomas.coopman at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070117/27dd427a/attachment.html 


More information about the Tutor mailing list