The Famous Error Message: "ImportError: No module named python_script"
rich murphy
RichardTRMurphy at yahoo.com
Wed Dec 13 20:16:39 EST 2006
I am studying Python language. I have Python 2.5 installed in my PC
which is running on Windows XP. I placed the the script called
"python_script" in C:\Python25 directory where all the other Python
files are.
When I tried to import the script called "python_script", it kept
printing the famous error message: "ImportError: No module named
python_script".
I took the file out of "C:\Python25" directory, placed it in
'C:\PythonTests'. The error message kept coming.
The "import" commnand will not work at all.
>>> import python_script
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named python_script
>>> import sys
>>> sys.path
['', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs',
'C:\\Python25\
\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk',
'C:\\Python25
', 'C:\\Python25\\lib\\site-packages']
>>> sys.path
['', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs',
'C:\\Python25\
\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk',
'C:\\Python25
', 'C:\\Python25\\lib\\site-packages']
>>> sys.path.append('C:\PythonTests')
>>> sys.path
['', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs',
'C:\\Python25\
\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk',
'C:\\Python25
', 'C:\\Python25\\lib\\site-packages', 'C:\\PythonTests']
I uninstall Python2.5, installed Python2.4: the result is the same. The
result is the same with older versions of Python also.
Does anybody know a remedy for this???
More information about the Python-list
mailing list