Skip to content

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

Description

@naomi-choy

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 to from 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'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions