From razieh.eskandari at gmail.com Fri Jul 9 09:32:34 2010 From: razieh.eskandari at gmail.com (r eskandari) Date: Fri, 9 Jul 2010 00:32:34 -0700 Subject: [Python-ir] python import error no module named Message-ID: 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: From razieh.eskandari at gmail.com Fri Jul 9 10:19:58 2010 From: razieh.eskandari at gmail.com (r eskandari) Date: Fri, 9 Jul 2010 01:19:58 -0700 Subject: [Python-ir] python import error no module named In-Reply-To: References: Message-ID: 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 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: From omidraha.com at gmail.com Fri Jul 9 22:20:39 2010 From: omidraha.com at gmail.com (Omid Raha) Date: Sat, 10 Jul 2010 00:50:39 +0430 Subject: [Python-ir] python import error no module named In-Reply-To: References: Message-ID: ???? ? ??? ???? ?? ?? ???? ????? ???? ???? ???? ????? ?? ?????? ???? . http://docs.python.org/tutorial/modules.html#the-module-search-path -- Omid Raha -------------- next part -------------- An HTML attachment was scrubbed... URL: