There's a simple way you can add your directory to the execution path.
try this
>>> sys.path.append(r'C:\python24\myPythonFiles')
now, you can import your file with the import command
>>> import yourFile
 
Note: This is only a temporary solution, when you close the interpreter, it will need to be appended again.
 
Hope that help.
 
----- Original Message -----
To: Tutor
Sent: Friday, May 12, 2006 9:24 PM
Subject: [Tutor] Runing a Python program

Hello people,
 
As a new python programmer, I created a directory in 'C:\python24\myPythonFiles',
and added a simple python under the myPythonFiles directory; but when I tried running it on the Python Shell, I got the following error.
 
>>> import myPythonFiles.readOut
 
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in -toplevel-
    import mypythonFiles.readOut
  ImportError: No module named myPythonFiles.readOut
 
>>>
How do I run a program that is placed on its own folder/directory?
 
Thanks
 
Henry


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to