Ernst79 / bleparser

Parser for passive BLE advertisements
MIT License
29 stars 15 forks source link

ImportError: cannot import name 'final' from 'typing' on bleparser 2.0 #25

Closed iointerrupt closed 2 years ago

iointerrupt commented 2 years ago

altbeacon.py references typing.Final was introduced in python 3.8.

Edit: Prior to 3.8 typing.Final is available in package in package typing_extensions. If using python prior to 3.8, refrences to typing.Final need to be updated to import typing_extensions in altbeacon.py, const.py and ibeacon.py

Ernst79 commented 2 years ago

bleparser is extracted from BLE monitor, which means that it only supports the python versions that Home Assistant supports. Python 3.7 support has been dropped in HA a while ago.

If you really need support for Python < 3.8, you can use

try:
    from typing import Final
except ImportError:
    from typing_extensions import Final
iointerrupt commented 2 years ago

I use bleparser to monitor my sensors and report via MQTT. Dont use HA (yet). I installed bleparser via pip from pypi which lists the requirement as >= 3.7. Believe it should be updated.

Ernst79 commented 2 years ago

Ah, thanks, will update that. Will be changed upon the next release, can't change it for the current release.