Closed Gamecock closed 1 year ago
I changed the import order
`from azure.iot.device import (
MQTTConnectionDroppedError,
MQTTConnectionFailedError,
ProvisioningSession,
)
the error changed, issue is with the package and not specific Module
`$ py samples/provisioning_symmetric_key.py Traceback (most recent call last): File "C:\Projects\Azure\azure-iot-sdk-python\samples\provisioning_symmetric_key.py", line 3, in <module> from azure.iot.device import ( ImportError: cannot import name 'MQTTConnectionDroppedError' from 'azure.iot.device' (C:\Projects\Azure\azure-iot-sdk-python\.venv\Lib\site-packages\azure\iot\device\__init__.py) (.venv)
3.0.0.b2 is not yet an official release, and its status is currently somewhat in flux.
I would recommend using the latest version of 2.x instead (2.12.0). Our apologies on the unclear nature of the messaging on this issue.
Context
OS and version used: Windows 10,22H2 Build 19045.3208
Python version: Python 3.11.1
pip version: pip 22.3.1
list of installed packages:
pip list Package Version
aiohttp 3.8.5 aiosignal 1.3.1 async-timeout 4.0.2 attrs 23.1.0 azure-iot-device 3.0.0b2 certifi 2023.7.22 charset-normalizer 3.2.0 frozenlist 1.4.0 idna 3.4 multidict 6.0.4 paho-mqtt 1.6.1 pip 22.3.1 PySocks 1.7.1 requests 2.31.0 requests-unixsocket 0.3.0 setuptools 65.5.0 typing_extensions 4.7.1 urllib3 1.26.16 yarl 1.9.2
cloned repo: ( If you are using a cloned sdk repository, in a command prompt: git describe )
git describe
fatal: No annotated tags can describe 'c6920dc120fbee6e39a24649896ab400af3a7c23'.
However, there were unannotated tags: try --tags.
Description of the issue
attmpting to run sample code, unable toimport Provisioning Session
$ py provisioning_symmetric_key.py Traceback (most recent call last): File "C:\Projects\Azure\azure-iot-sdk-python\samples\provisioning_symmetric_key.py", line 3, in
from azure.iot.device import (
ImportError: cannot import name 'ProvisioningSession' from 'azure.iot.device' (C:\Projects\Azure\azure-iot-sdk-python\samples.venv\Lib\site-packages\azure\iot\device__init__.py)
Code sample exhibiting the issue
$ py Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
Console log of the issue
$ ls .venv/Lib/site-packages/azure/iot/device/ init.py connection_string.py edge_hsm.py iothub_http_client.py models.py mqtt_topic_provisioning.py signing_mechanism.py pycache/ constant.py http_path_iothub.py iothub_mqtt_client.py mqtt_client.py request_response.py user_agent.py config.py custom_typing.py iot_exceptions.py iothub_session.py mqtt_topic_iothub.py sastoken.py (.venv) FinchMik Consider setting the DEBUG environment variable to '*'. This will produce a much more verbose output that will help debugging Don't forget to remove any connection string information!