[Tutor] Wrong version of Python being executed

Tony Cappellini cappy2112 at gmail.com
Sun Nov 11 03:35:13 CET 2007


Thanks for replying Kent.
This is quite a strange mystery.

> A couple of possibilities...
> Is there a #! line at the start of the script that specifies Python 2.3
> (I'm not sure if those work in windows though...)
No- The shebang line is for non-Windows systems (Unix variants)

> How do you run the script? If you double-click it, perhaps the file
> association with .py files is to Python 2.3?
I run the script by typing python script.py

> Conceivably the Python 2.5 module path is incorrect and imports the
> wrong module. What happens if you import logging from the interpreter
> prompt and print its file?

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.__file__
'C:\\PYTHON25\\lib\\logging\\__init__.pyc'


What do you get if you print sys.path from
> the interpreter?

>>> 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',
'C:\\PYTHON25\\lib\\site-packages\\win32'
, 'C:\\PYTHON25\\lib\\site-packages\\win32\\lib',
'C:\\PYTHON25\\lib\\site-packages\\Pythonwin', 'C:\\PYTHON25\\lib\\sit
e-packages\\wx-2.8-msw-ansi']


More information about the Tutor mailing list