[Tutor] Runing a Python program
Evans Anyokwu
fiveholiday55 at hotmail.com
Sat May 13 13:55:08 CEST 2006
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 -----
From: Henry Dominik
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 at python.org
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060513/62038016/attachment.htm
More information about the Tutor
mailing list