vicyap / sainsmart

A Python library to control sainsmart relays.
MIT License
3 stars 3 forks source link

Python 3 error no module named sainsmart #27

Open fredtr opened 3 years ago

fredtr commented 3 years ago

Description

from sainsmart import devices Works fine Python2 Python3 error "no module named sainsmart"

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

What I Did

pip install sainsmart Looked like Python 3 is supported from Github, did latest install and it didn't help.

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: sainsmart in /usr/local/lib/python2.7/dist-packages (0.3.1) Requirement already satisfied: typing==3.6.1 in /usr/local/lib/python2.7/dist-packages (from sainsmart) (3.6.1) Requirement already satisfied: requests==2.18.0 in /usr/local/lib/python2.7/dist-packages (from sainsmart) (2.18.0) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/dist-packages (from requests==2.18.0->sainsmart) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python2.7/dist-packages (from requests==2.18.0->sainsmart) (2018.8.24) Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests==2.18.0->sainsmart) (2.5) Requirement already satisfied: urllib3<1.22,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests==2.18.0->sainsmart) (1.21.1)

fredtr commented 3 years ago

I reloaded designating python3, now I have the following error:

relay = devices.EthernetRelay() File "/usr/local/lib/python3.7/dist-packages/sainsmart/devices.py", line 29, in init self._relays = self.state() File "/usr/local/lib/python3.7/dist-packages/sainsmart/devices.py", line 61, in state content = r.content.decode('ascii') UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 89: ordinal not in range(128)