digi xbee python version

Hello,

I need to manage several version of the digi python library https://github.com/digidotcom/xbee-python/releases

And normally in python to get the version of the package, I just do
import package_name
print(package_name.version)
However it doesn’t work with the digi-xbee one. I have check and at least in the old release I a unable to find the version file.
So how can I check the version of the digi xbee library that I am currently using from python.

Thanks in advance

Hi vincentlc,

The version attribute is a de-facto standard that modules and packages SHOULD provide, but it is not mandatory (see https://www.python.org/dev/peps/pep-0396/). It seems the digi-xbee library does not provide this attribute.

I did some experimentation and found that you can retrieve the version of the library using pkg_resources as follows:

>>> import pkg_resources
>>> pkg_resources.get_distribution(‘digi-xbee’).version
‘1.3.0’
>>>

I will suggest that the Python XBee library developers add a version attribute to future releases.

2 Likes

Thanks a lot, works perfectly