March 23rd, 2005, 07:00 AM
Join Date: Apr 2004
Time spent in forums: 53 m 49 sec
Reputation Power: 0
Running new code with old Python versions
I would like to make sure that people running my Python script are using a proper version of Python.
if sys.version[:3] < 2.1:
print "You are using an old version of python."
a += 3
When running this code, Python tells me that it found some 'invalid syntax'.
So, it seems that Python is first parsing the whole file and complaining about things it does not understand and then starting execution.
How to perform such a check correctly?
Thank you, B.