Entry
How can I check that the Python version is recent enough to run my program?
Jul 1st, 2008 11:37
sheana krat, Nathan Wallace, Fredrik Lundh, Oleg Broytmann
Note that [1, 5, 2] < [1, 6]. in other words, this will do what you
want:
import string, sys
version = string.split(string.split(sys.version)[0], ".")
if map(int, version) < [1, 5, 2]:
print "sorry"
I can be better to not check the version - this will bound poor user to
one version. Instead, check for the feature you need. You need a
library? Try to import it and fall back gracefully:
try:
import pagecast_lib
except ImportError:
print_error()
if not pagecast_lib.has_key("I_need_IT"):
print_another_error()
http://www.indianhandicraftsexporters.com
http://www.topgiftsideas.com
http://www.eindianweddingcards.com