tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
130 stars 49 forks source link

ImportError: cannot import name 'Literal' from 'typing' using python 3.7.9 #60

Open naomi-choy opened 2 years ago

naomi-choy commented 2 years ago

trying to run api.py from example, it shows the following errors:

File "api.py", line 2, in from tuya_iot import TuyaOpenAPI, tuya_logger File "C:\Users\yolo\AppData\Local\Programs\Python\Python37\lib\site-packages\tuya_iot__init__.py", line 2, in from .device import TuyaDevice, TuyaDeviceListener, TuyaDeviceManager File "C:\Users\yolo\AppData\Local\Programs\Python\Python37\lib\site-packages\tuya_iot\device.py", line 7, in from typing import Any, Literal, Optional ImportError: cannot import name 'Literal' from 'typing'

changing the import routes in device.py tofrom typing_extensions import Literal as suggested in stackoverflow gives the following error:

File "api.py", line 2, in from tuya_iot import TuyaOpenAPI, tuya_logger ImportError: cannot import name 'tuya_logger' from 'tuya_iot'