Failing gracefully when installed Python is too old?

Grant Edwards grante at
Mon Jul 16 19:46:43 CEST 2001

I can't figure out a way for a Python program to fail
gracefully if somebody attempts to run it with a version of
Python that's too old.

Checking sys.hexversion at runtime won't work because the
program might not even parse.  For example, attempting to run
a program containing list comprehensions under 1.5.2.

Is there any way to check the version at compile time?

Grant Edwards                   grante             Yow!  Sometime in 1993
                                  at               NANCY SINATRA will lead a
                                 BLOODLESS COUP on GUAM!!

More information about the Python-list mailing list