How to check version of Python under CGI

Tim Hammerquist tim at vegeta.ath.cx
Thu Jun 13 05:13:13 EDT 2002


Johann graced us by uttering:
> I would like to write a simple CGI script to get as much info about
> installed Python as possible. But I even don't know how to check
> version of Python. :( From shell command  it is easy, but how to do it
> from CGI script? Eg.
> 
> #!/usr/bin/env python
> print "Content-type: text/html\n\n"
> print "Python version: %s" %s (IDoNotKnowWhatToChoose(),)

import sys

print sys.version       # version info in string
print sys.version_info  # version info in tuple

HTH
Tim Hammerquist
-- 
Tools, of course, can be the subtlest of traps.
    -- Daniel, The Sandman



More information about the Python-list mailing list