[Python-ir] python import error no module named

r eskandari razieh.eskandari at gmail.com
Fri Jul 9 10:19:58 CEST 2010


OOOOOOOh! what a big mistake! I found it, Python import files from other
directory! my example project install itself in the other path and i forgot
about it!!
Sorry!!

On Fri, Jul 9, 2010 at 12:32 AM, r eskandari <razieh.eskandari at gmail.com>wrote:

> Dear All,
>
> Hello,
>
> I am very new at python. I have an existing example project that have some
> scripts YYY,in path XXX/YYY and an script A.py that call these one by one.
>
> i.e, YYY is colection of py files { y1.py, y2.py,....}, that are imported
> to A.py.
> I mean that in A.py file we have this:
>
> import XXX.y1 as Y1
> Y1.doSomething1()
> import XXX.y2 as Y2
> Y2.doSomething2()
>
> ... and so,
>
> I only want to add an script ZZZ.py to the YYY scripts in the XXX
> directory, so that call ZZZ.doSomething() after calling YYY.doSomething().
>
> Although all y1.py,y2.py,... files in XXX directory are called in the same
> way, but when I add new python file in XXX directory, and name it ZZZ.py and
> change A.py to this:
>
> import XXX.y1 as Y1
> Y1.doSomething1()
> import XXX.y2 as Y2
> Y2.doSomething2()
> import XXX.ZZZ as Z
> Z.doSomething()
>
> Python can not import ZZZ. and returns "
>
> Dear All,
>
> Hello,
>
> I am very new at python. I have an existing example project that have some
> scripts YYY,in path XXX/YYY and an script A.py that call these one by one.
>
> i.e, YYY is colection of py files { y1.py, y2.py,....}, that are imported
> to A.py.
> I mean that in A.py file we have this:
>
> import XXX.y1 as Y1
> Y1.doSomething1()
> import XXX.y2 as Y2
> Y2.doSomething2()
>
> ... and so,
>
> I only want to add an script ZZZ.py to the YYY scripts in the XXX
> directory, so that call ZZZ.doSomething() after calling YYY.doSomething().
>
> Although all y1.py,y2.py,... files in XXX directory are called in the same
> way, but when I add new python file in XXX directory, named it to ZZZ.py and
> change A.py to this:
>
> import XXX.y1 as Y1
> Y1.doSomething1()
> import XXX.y2 as Y2
> Y2.doSomething2()
> import XXX.ZZZ as Z
> Z.doSomething()
>
> I got this error "python import error no module named XXX/ZZZ.py"
> Python can not import ZZZ!
> I wounder what is the difference between ZZZ.py and y1.py or y2.py,....
>
> Why python can import XXX/YYY py files but returns this error for ZZZ.py?
>
> Anybody could help me?
>
> Thanks in advance.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ir/attachments/20100709/d175e96c/attachment.html>


More information about the Python-ir mailing list