xiaomi-flower-care-api
xiaomi-flower-care-api copied to clipboard
Can't install
Hi,
I'm trying to install your api. I had some problems to install bluepy, but now I solved it, I get this error I don't know how to resolve:
pip3 install ./xiaomi-flower-care-api/
Processing ./xiaomi-flower-care-api
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-89uw8bo2-build/setup.py", line 13, in <module>
long_description=readme(),
File "/tmp/pip-89uw8bo2-build/setup.py", line 7, in readme
return readme_file.read()
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 830: ordinal not in range(128)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-89uw8bo2-build/
Can you help me? I don't know a lot of python, so maybe it's trivial, sorry if I asking something too simple.
Thanks!
I fixed it adding encoding='utf8' to setup.py:
def readme():
with open('README.md', encoding='utf8') as readme_file:
return readme_file.read()
But now I have a problem executing read.py:
~/xiaomi-flower-care-api/example $ sudo python3 read.py
Getting data from device..
Traceback (most recent call last):
File "read.py", line 15, in <module>
print('Name: {}'.format(sensor.name))
File "../flowercare/reader.py", line 39, in name
response = self._read_handle(_HANDLE_DEVICE_NAME)
File "../flowercare/reader.py", line 127, in _read_handle
with Peripheral(self._mac, iface=self._interface) as connection:
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 391, in __init__
self._connect(deviceAddr, addrType, iface)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 434, in _connect
rsp = self._getResp('stat')
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 407, in _getResp
resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 339, in _waitResp
raise BTLEInternalError("Helper exited")
bluepy.btle.BTLEInternalError: Helper exited
Exception ignored in: <bound method Peripheral.__del__ of <bluepy.btle.Peripheral object at 0xb6aa5870>>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in __del__
self.disconnect()
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect
self._writeCmd("disc\n")
File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd
self._helper.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe
I get the exact same error.
I have also encountered the same error with Python 3.5.3 @vrachieru Could you please write which Python version did you use?
same error here. python3 --version: Python 3.7.3
Me too, Python 3.7.3
i get an error Successfully built flowercare Failed to build bluepy Installing collected packages: bluepy, flowercare Running setup.py install for bluepy ... error ERROR: Complete output from command /usr/local/opt/python/bin/python3.7 -u -c 'import setuptools, tokenize;file='"'"'/private/var/folders/ym/k81rfk4n4914jsk7yzvqbn2jtk9071/T/pip-install-pz7e0fzf/bluepy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/ym/k81rfk4n4914jsk7yzvqbn2jtk9071/T/pip-record-i654mvci/install-record.txt --single-version-externally-managed --compile:
This is not a python issue but a shell issue.
If it happens when using SSH, this is a fault on the SSH client, not the RPi. For example using an Ubuntu machine as the SSH client will cause this problem. To fix this SSH problem, edit the file /etc/ssh/ssh_config on the SSH client (not the RPi) and remove the line SendEnv LANG LC_*
I had this issue when accessing my raspberry through ssh, removing the SendEnv line solved the issue and I could install xiaomi-flower-care-api properly
I fixed it adding encoding='utf8' to setup.py:
def readme(): with open('README.md', encoding='utf8') as readme_file: return readme_file.read()
But now I have a problem executing read.py:
~/xiaomi-flower-care-api/example $ sudo python3 read.py Getting data from device.. Traceback (most recent call last): File "read.py", line 15, in <module> print('Name: {}'.format(sensor.name)) File "../flowercare/reader.py", line 39, in name response = self._read_handle(_HANDLE_DEVICE_NAME) File "../flowercare/reader.py", line 127, in _read_handle with Peripheral(self._mac, iface=self._interface) as connection: File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 391, in __init__ self._connect(deviceAddr, addrType, iface) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 434, in _connect rsp = self._getResp('stat') File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 407, in _getResp resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout) File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 339, in _waitResp raise BTLEInternalError("Helper exited") bluepy.btle.BTLEInternalError: Helper exited Exception ignored in: <bound method Peripheral.__del__ of <bluepy.btle.Peripheral object at 0xb6aa5870>> Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in __del__ self.disconnect() File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect self._writeCmd("disc\n") File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd self._helper.stdin.flush() BrokenPipeError: [Errno 32] Broken pipe
did you ever resolved this ?
With Python3 bluepy may need an additional libraries: libglib2.0-dev based on bluepy
sudo apt-get install python3-pip libglib2.0-dev sudo pip3 install bluepy