erdose / xiaomi-mi-lywsd03mmc

Xiaomi Mi BLE Temperature & Humidity Sensor
MIT License
26 stars 7 forks source link

Problem script #2

Closed Sixela096 closed 3 years ago

Sixela096 commented 3 years ago

Hello,

I encounter the following error with the script, do you have an idea?

python3 xiaomiBleLywsd03mmc.py

  File "xiaomiBleLywsd03mmc.py", line 18
    logger.info(f"Temp: {temperature}")
                                     ^
SyntaxError: invalid syntax

Thanks for help !

erdose commented 3 years ago

What type of python did you use? The f-string is a Python 3.6 feature! I think you need to update the interpreter!

Sixela096 commented 3 years ago

Hello,

I have other problem with version 3.6

python3.6 xiaomiBleLywsd03mmc.py
Traceback (most recent call last):
  File "xiaomiBleLywsd03mmc.py", line 7, in <module>
    from bluepy.btle import UUID, Peripheral, ADDR_TYPE_PUBLIC, DefaultDelegate, Scanner
ModuleNotFoundError: No module named 'bluepy'
erdose commented 3 years ago

Please read the instruction in ReadMe file! You need to prepare your system: sudo apt install -y python3 python3-pip git sudo pip3 install requests bluepy

Sixela096 commented 3 years ago

Please read the instruction in ReadMe file! You need to prepare your system: sudo apt install -y python3 python3-pip git sudo pip3 install requests bluepy

It's already in place, What is your OS version?

mer. déc. 16 16:07 root@PI3:/home/pi/domoticz/scripts/python/xiaomi-mi-lywsd03mmc:#sudo pip3 install requests bluepy
Requirement already satisfied: requests in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: bluepy in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests)
mer. déc. 16 16:07 root@PI3:/home/pi/domoticz/scripts/python/xiaomi-mi-lywsd03mmc:#sudo apt install -y python3 python3-pip git
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
git is already the newest version (1:2.11.0-3+deb9u7).
python3 is already the newest version (3.5.3-1).
python3-pip is already the newest version (9.0.1-2+rpt2).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 15 non mis à jour
erdose commented 3 years ago

I have a Rpi Zero W and the system is: cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian

Sixela096 commented 3 years ago

I have a Rpi Zero W and the system is: cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian

Hello,

I have the problem on the versions python 3.6/3.7/3.8 and I'm on the same OS as you, do you have an idea? `

mer. déc. 16 20:01 root@PI3:/home/pi/domoticz/scripts/python/xiaomi-mi-lywsd03mmc:#cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

mer. déc. 16 20:01 root@PI3:/home/pi/domoticz/scripts/python/xiaomi-mi-lywsd03mmc:#python3.6 xiaomiBleLywsd03mmc.py Traceback (most recent call last): File "xiaomiBleLywsd03mmc.py", line 7, in from bluepy.btle import UUID, Peripheral, ADDR_TYPE_PUBLIC, DefaultDelegate, Scanner ModuleNotFoundError: No module named 'bluepy.btle'

mer. déc. 16 20:02 root@PI3:/home/pi/domoticz/scripts/python/xiaomi-mi-lywsd03mmc:#python3.7 xiaomiBleLywsd03mmc.py Traceback (most recent call last): File "xiaomiBleLywsd03mmc.py", line 7, in from bluepy.btle import UUID, Peripheral, ADDR_TYPE_PUBLIC, DefaultDelegate, Scanner ModuleNotFoundError: No module named 'bluepy.btle'

mer. déc. 16 20:02 root@PI3:/home/pi/domoticz/scripts/python/xiaomi-mi-lywsd03mmc:#python3.8 xiaomiBleLywsd03mmc.py Traceback (most recent call last): File "xiaomiBleLywsd03mmc.py", line 7, in from bluepy.btle import UUID, Peripheral, ADDR_TYPE_PUBLIC, DefaultDelegate, Scanner ModuleNotFoundError: No module named 'bluepy.btle' `

erdose commented 3 years ago

I think you need to upgrade the python version (my version is Python 3.7.3.). Try to check with this command python3 --version and you have to set the right version when you run the python3 command. Check this!

Sixela096 commented 3 years ago

I am already in 3.7.3 mer. déc. 16 20:50 root@PI3:/home/pi/domoticz/scripts/python#python3 --version Python 3.7.3

I will use another solution, thanks for your help.