Home        Store        Learn        Blog

Issues with tsys01-python for running Celsius sensor on Pi

Hi,

We have been working on integrating the Celsius sensor into a custom project running from a Raspberry Pi - using the tsys01-python package released by BlueRobotics. We have discovered an issue getting the package loaded and after a lot of head scratching think that this is due to an issue with the import statements.

The error comes in the import statement:
File “/home/pi/tsys01-python/tsys01/init.py”, line 1, in
from tsys01 import TSYS01
ImportError: cannot import name ‘TSYS01’ from ‘tsys01’

I see that the same error has been raised previously (No module named tsys01 · Issue #4 · bluerobotics/tsys01-python · GitHub) , but that errors due to not correctly installing were suggested as the cause. However, the installation was followed here and we have reproduced the issue on different systems.

It seems that adding a ‘.’ to make this a relative import in the init : from .tsys01 import TSYS01 fixes this. Open to other thoughts/suggestions though.

We are also running on Python3 - are we right in thinking the package on Github is for Python 2.7 (there seem to be some print statements not compatible with Python3)?

We are also running on Python3 - are we right in thinking the package on Github is for Python 2.7 (there seem to be some print statements not compatible with Python3)?

Yes the package supports python 2, and you will see the error you encountered with python 3. We are working on fixing support for python 3:

The master branch has been updated, it should work with python2 and python3 now.