Skip to content

The __version__ attribute disappeared from version 5.0.1 to version 5.1.1 #1671

Answered by ribes4
ribes4 asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for your answer. Reading the PEP I have realized that this way of specifying the version became obsolete a few months ago (https://www.python.org/dev/peps/pep-0396/#pep-rejection).

And that a good way to check the version is using for example the importlib library. I write here the way to check the version, for future users:

For Python versions >=3.8:

>>> from importlib.metadata import version  
>>> version('flask_socketio')  
'5.1.1'

And for previous Python versions:

>>> from importlib_metadata import version
>>> version('flask_socketio')
'5.1.1'

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by miguelgrinberg
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1670 on August 27, 2021 08:38.