469,964 Members | 1,684 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

the way of "import"


I have three files names t1.py,t2.py,t3.py in e:\test\dir1,of course
dir2 is exsit
the content of t1.py as follow:
t1.py
import os
print 'this is t1.py'
os.chdir('..\\dir2')
the content of t2.py as follow:
print "this is t2.py"
the content of t3.py as follow:
import t1
import t2
if i run t3.py in cmd of windows as follow:
python t3.py

no errors show

if i run t3.py in idle:
>>import t3
this is t1.py
Traceback (most recent call las
File "<stdin>", line 1, in <module>
File "t3.py", line 2, in <module>
ImportError: No module named t2

can you give me a help?
Mar 8 '08 #1
1 1212
En Sat, 08 Mar 2008 00:30:13 -0200, smalltalk <tt******@gmail.com>
escribi�:
I have three files names t1.py,t2.py,t3.py in e:\test\dir1,of course
dir2 is exsit
the content of t1.py as follow:
t1.py
import os
print 'this is t1.py'
os.chdir('..\\dir2')
the content of t2.py as follow:
print "this is t2.py"
the content of t3.py as follow:
import t1
import t2
if i run t3.py in cmd of windows as follow:
python t3.py

no errors show

if i run t3.py in idle:
>>>import t3
this is t1.py
Traceback (most recent call las
File "<stdin>", line 1, in <module>
File "t3.py", line 2, in <module>
ImportError: No module named t2

can you give me a help?
Which Python version? Which Windows version? With IDLE from Python 2.5.1
on XP I don't get the error (and that's the right thing)

--
Gabriel Genellina

Mar 9 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Vio | last post: by
9 posts views Thread by monkey | last post: by
5 posts views Thread by mark_galeck_spam_magnet | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.