11

How do I get the current version of my Python Tornado module version?

With other packages I can do the following:

print <modulename>.__version__

Source: How to check version of Python modules

1
  • 1
    Have you tried using dir to see if there are any attributes that might be it?
    – jonrsharpe
    Jun 30, 2015 at 18:53

3 Answers 3

10

Tornado has both tornado.version, which is a string for human consumption (currently "4.2"), and tornado.version_info, which is a numeric tuple that is better for programmatic comparisons (currently (4, 2, 0, 0)). The fourth value of version_info will be negative for betas and other pre-releases.

2
  • 1
    Is this specific to python tornado -> or should we be trying these properties on other packages which don't have .__version__ ??
    – D A
    Jul 1, 2015 at 5:26
  • 1
    There's no standard about this, so it's worth a try on other packages. version and version_info are the names used in the sys module, and I know that pycurl uses the same names (although in pycurl version_info is a function instead of an attribute) Jul 1, 2015 at 14:06
3

If using Ubuntu, open a terminal and type python. Then import tornado and the write command tornado.version.

You will get output like '4.2.1'.

2

With no reference, or reason I tried the following:

print tornado.version

which seems to do the trick.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.