Giter Site home page Giter Site logo

azure / azure-iot-sdk-python Goto Github PK

View Code? Open in Web Editor NEW
416.0 84.0 375.0 45.78 MB

A Python SDK for connecting devices to Microsoft Azure IoT services

License: MIT License

Shell 0.82% Python 99.01% PowerShell 0.07% Dockerfile 0.05% JavaScript 0.05%
python microsoft azure azure-iot azure-iot-sdks azure-iothub device-sdk iothub sdk iot

azure-iot-sdk-python's Introduction

azure-iot-device

Build Status

The Azure IoT Device SDK for Python enables Python developers to easily create IoT device solutions that seamlessly connect to the Azure IoT Hub ecosystem.

  • If you're looking for the azure-iot-hub library, it is now located in the azure-iot-hub-python repository

  • If you're looking for the v1.x.x client library, it is now preserved in the v1-deprecated branch.

Installing the library

The Azure IoT Device library is available on PyPI:

pip install azure-iot-device

Python 3.7 or higher is required in order to use the library

Using the library

API documentation for this package is available via Microsoft Docs.

See our quickstart guide for step by step instructions for setting up and using an IoTHub with devices.

You can also view the samples repository to see additional examples of basic client usage.

Want to start off on the right foot? Be sure to learn about common pitfalls of using this Python SDK before starting a project.

Features

✔️ feature available ✖️ feature planned but not yet supported ➖ no support planned*

*Features that are not planned may be prioritized in a future release, but are not currently planned

These clients only support the MQTT protocol.

IoTHub Device Client

Features Status Description
Authentication ✔️ Connect your device to IoT Hub securely with supported authentication, including symmetric key, X-509 Self Signed, Certificate Authority (CA) Signed, and SASToken
Send device-to-cloud message ✔️ Send device-to-cloud messages (max 256KB) to IoT Hub with the option to add custom properties.
Receive cloud-to-device messages ✔️ Receive cloud-to-device messages and read associated custom and system properties from IoT Hub.
Device Twins ✔️ IoT Hub persists a device twin for each device that you connect to IoT Hub. The device can perform operations like get twin tags, subscribe to desired properties.
Direct Methods ✔️ IoT Hub gives you the ability to invoke direct methods on devices from the cloud. The SDK supports handler for method specific and generic operation.
Connection Status and Error reporting ✔️ Error reporting for IoT Hub supported error code.
Connection Retry ✔️ Dropped connections will be retried with a fixed 10 second interval by default. This functionality can be disabled if desired, and the interval can be configured
Upload file to Blob ✔️ A device can initiate a file upload and notifies IoT Hub when the upload is complete.

IoTHub Module Client

Note: IoT Edge for Python is scoped to Linux containers & devices only. Learn more about using Linux containers for IoT edge on Windows devices.

Features Status Description
Authentication ✔️ Connect your device to IoT Hub securely with supported authentication, including symmetric key, X-509 Self Signed, and Certificate Authority (CA) Signed. SASToken authentication is not currently supported.
Send device-to-cloud message ✔️ Send device-to-cloud messages (max 256KB) to IoT Hub with the option to add custom properties.
Receive cloud-to-device messages ✔️ Receive cloud-to-device messages and read associated custom and system properties from IoT Hub, with the option to complete/reject/abandon C2D messages.
Device Twins ✔️ IoT Hub persists a device twin for each device that you connect to IoT Hub. The device can perform operations like get twin tags, subscribe to desired properties.
Direct Methods ✔️ IoT Hub gives you the ability to invoke direct methods on devices from the cloud. The SDK supports handler for method specific and generic operation.
Connection Status and Error reporting ✔️ Error reporting for IoT Hub supported error code.
Connection Retry ✔️ Dropped connections will be retried with a fixed 10 second interval. TThis functionality can be disabled if desired, and the interval can be configured
Direct Invocation of Method on Modules ✔️ Invoke method calls to another module using using the Edge Gateway.

Provisioning Device Client

Features Status Description
TPM Individual Enrollment Provisioning via Trusted Platform Module.
X.509 Individual Enrollment ✔️ Provisioning via X.509 root certificate. Please review the samples folder and this quickstart on how to create a device client.
X.509 Enrollment Group ✔️ Provisioning via X.509 leaf certificate). Please review the samples folder on how to create a device client.
Symmetric Key Enrollment ✔️ Provisioning via Symmetric key attestation). Please review the samples folder on how to create a device client.

Critical Upcoming Changes Notice

Certificates

All Azure IoT SDK users are advised to be aware of upcoming TLS certificate changes for Azure IoT Hub and Device Provisioning Service that will impact the SDK's ability to connect to these services. In October 2022, both services will migrate from the current Baltimore CyberTrust CA Root to the DigiCert Global G2 CA root. There will be a transition period beforehand where your IoT devices must have both the Baltimore and Digicert public certificates installed in their certificate store in order to prevent connectivity issues.

Devices with only the Baltimore public certificate installed will lose the ability to connect to Azure IoT hub and Device Provisioning Service in October 2022.

To prepare for this change, make sure your device's certificate store has both of these public certificates installed.

For a more in depth explanation as to why the IoT services are doing this, please see this article.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

azure-iot-sdk-python's People

Contributors

bertkleewein avatar bradleydamato avatar cartertinney avatar danewalton avatar danhellem avatar dominicbetts avatar elhorton avatar ericmitt avatar fratster avatar jebrando avatar jimacoms4 avatar lev-i avatar lrivallain avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar olivakar avatar pierreca avatar sharmasejal avatar timtay-microsoft avatar vishnureddy17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-iot-sdk-python's Issues

find_package fails for python 3

  • OS and version used: Ubuntu 15.04 as host

  • Python runtime used: Python 3.4

  • SDK version used: master 2017 maj 09

Description of the issue:

When cross-compiling find_package does not find libs for boost python3
including my ugly fix for the issue to clarify.

 --- a/device/iothub_client_python/CMakeLists.txt
+++ b/device/iothub_client_python/CMakeLists.txt
         string(REPLACE "." "" boost_python ${build_python})
-        find_package(Boost COMPONENTS "python-py${boost_python}")
+        find_package(Boost COMPONENTS "python3")

--- a/service/CMakeLists.txt
+++ b/service/CMakeLists.txt
         string(REPLACE "." "" boost_python ${build_python})
-        find_package(Boost COMPONENTS "python-py${boost_python}")
+        find_package(Boost COMPONENTS "python3") 

Code sample exhibiting the issue:

Console log of the issue:

ImportError: DLL load failed: The specified module could not be found

  • OS and version used: < Windows 7 >

print (sys.version)
3.5.4rc1 (v3.5.4rc1:385b368, Jul 24 2017, 14:37:10) [MSC v.1900 64 bit (AMD64)]

-# Description of the issue:
import iothub_client
File "C:\Users\pugal\AppData\Local\Programs\Python\Python35\lib
\site-packages\iothub_client_init_.py", line 1, in
from .iothub_client import *
ImportError: DLL load failed: The specified module could not be found.

Code sample exhibiting the issue:

import iothub_client

in sample code no DeviceId was found

Ubuntu 17.04
Python 3.5.3
sdk version 1.1.17

I tried to execute the iothub_client_sample.py. The only Console output i could get are these:
I removed the values of the connection string and replaced them with the string value.
python3 iothub_client_sample.py -p mqtt -c HostName=value;DeviceId=value;SharedAccessKey=value

Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118]
IoT Hub Client for Python
Starting the IoT Hub Python sample...
Protocol MQTT
Connection string=HostName=value
Info: IoT Hub SDK for C, version 1.1.17
Error: Time:Wed Jun 21 14:05:22 2017 File:/home/me/Documents/Projects/azure-iot-sdk-python/c/iothub_client/src/iothub_client_ll.c Func:IoTHubClient_LL_CreateFromConnectionString Line:672 deviceId is not found
Error: Time:Wed Jun 21 14:05:22 2017 File:/home/me/Documents/Projects/azure-iot-sdk-python/c/iothub_client/src/iothub_client.c Func:create_iothub_instance Line:763 Failure creating iothub handle
Unexpected error IoTHubClient.IoTHubClient, IoTHubClientResult.ERROR from IoTHub

I have build all the stuff like it was described in the installation section. I have build it for the Python version 3.5.

MQTT is not delivering the system properties: correlation_id and message_id

  • OS and version used: Debian 8.9

  • Python runtime used: Python 2.7.9

  • SDK version used: 1.0.37

Description of the issue:

MQTT is not delivering the system properties: correlation_id and message_id
After correlation_id and message_id were set in IoTHubMessage, the reply message delivered to IoTHub does not contain correlation_id and message_id properties. Please, see the example below,

Code sample exhibiting the issue:

info_json = "{ 'channel' : 'httpResp', 'status' : 'HTTP/1.1 200 OK', 'headers' : { "'Server' : 'nginx/1.11.4', 'Content-type' : 'application/json', 'Transfer-Encoding' : 'chunked' , 'Connection' : 'keep-alive' }, 'body' : { 'data' } "

msg = IoTHubMessage(bytearray(info_json, 'utf8'))

Method 1

msg.correlation_id = 'value1'
msg.message_id = 'value2'

Method 2

msg_prop = msg.properties()
msg.pop.add('correlationId','value1')
msg.pop.add('messageId','value2')

client.send_event_async(msg, send_confirmation_callback, message_counter)

None of these methods work, the message sent does not contains the properties: correlation_id and message_id.

NOTE: For method 2, I used other possibilities of keys like: correlation_id, correlationId, CorrelationId, CorrelationIds

For our application is required and mandatory reply the correlation_id and message_id

Please, what can be done in order to fix this issue?

Console log of the issue:

No errors, the message is sent correctly, but, correlation_id and message_id are not delivered in the message

cross-compile issues

  • OS and version used:
    openwrt 10.03

  • Python runtime used:
    2.7.12

  • SDK version used:
    azure-iot-sdk-python

Description of the issue:

Enconter errs while cross-compile,
make[2]: *** [python/test/CMakeFiles/iothub_client_mock.dir//src/iothub_client_python.cpp.o] Error 1
make[1]: *** [python/test/CMakeFiles/iothub_client_mock.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [python_service_client/tests/CMakeFiles/iothub_service_client_mock.dir/
/src/iothub_service_client_python.cpp.o] Error 1
make[1]: *** [python_service_client/tests/CMakeFiles/iothub_service_client_mock.dir/all] Error 2
make: *** [all] Error 2

Code sample exhibiting the issue:

./build.sh --toolchain-file toolchain-openwrt.cmake -cl -ldl

Console log of the issue:

[ 40%] Building C object iothub_client/CMakeFiles/iothub_client.dir/src/iothubtransport.c.o
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:734:72: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:734:72: error: 'constexpr' needed for in-class initialization of static data member '_iothubServiceClientAuthHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubServiceClientAuth::IoTHubServiceClientAuth(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:742:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubServiceClientAuth::Destroy()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:759:13: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'IOTHUB_SERVICE_CLIENT_AUTH_TAG* IoTHubServiceClientAuth::GetHandle()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:768:16: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: At global scope:
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:832:72: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:832:72: error: 'constexpr' needed for in-class initialization of static data member '_iothubServiceClientAuthHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:833:66: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:833:66: error: 'constexpr' needed for in-class initialization of static data member '_iothubRegistryManagerHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubRegistryManager::IoTHubRegistryManager(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:843:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:849:9: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubRegistryManager::IoTHubRegistryManager(IoTHubServiceClientAuth)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:863:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope[ 41%] Building C object uamqp/CMakeFiles/uamqp.dir/src/header_detect_io.c.o

/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:869:9: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubRegistryManager::Destroy()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:886:13: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:892:13: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'IOTHUB_DEVICE IoTHubRegistryManager::CreateDevice(std::string, std::string, std::string, IOTHUB_REGISTRYMANAGER_AUTH_METHOD)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:918:53: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'IOTHUB_DEVICE IoTHubRegistryManager::GetDevice(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:935:50: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubRegistryManager::UpdateDevice(std::string, std::string, std::string, IOTHUB_DEVICE_STATUS, IOTHUB_REGISTRYMANAGER_AUTH_METHOD)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:962:53: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubRegistryManager::DeleteDevice(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:977:53: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'boost::python::list IoTHubRegistryManager::GetDeviceList(size_t)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:994:54: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'IOTHUB_REGISTRY_STATISTICS IoTHubRegistryManager::GetStatistics()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1022:54: error: '_iothubRegistryManagerHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: At global scope:
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1220:72: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1220:72: error: 'constexpr' needed for in-class initialization of static data member '_iothubServiceClientAuthHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1221:61: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1221:61: error: 'constexpr' needed for in-class initialization of static data member '_iothubMessagingHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1222:48: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1222:48: error: 'constexpr' needed for in-class initialization of static data member 'openCompleteContext' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1223:48: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1223:48: error: 'constexpr' needed for in-class initialization of static data member 'sendCompleteContext' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1224:62: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1224:62: error: 'constexpr' needed for in-class initialization of static data member 'feedbackMessageContext' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::CreateContexts()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1228:13: error: 'openCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1230:13: error: 'sendCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1232:13: error: 'feedbackMessageContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::DestroyContexts()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1238:13: error: 'openCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1240:39: error: type '' argument given to 'delete', expected pointer
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1242:13: error: 'sendCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1244:39: error: type '' argument given to 'delete', expected pointer
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1246:13: error: 'feedbackMessageContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1248:42: error: type '' argument given to 'delete', expected pointer
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubMessaging::IoTHubMessaging(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1259:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1265:9: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubMessaging::IoTHubMessaging(IoTHubServiceClientAuth)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1280:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1286:9: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::Destroy()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1304:13: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1310:13: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::Open(boost::python::api::object&, boost::python::api::object&)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1324:13: error: 'openCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1331:39: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1331:85: error: 'openCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::Close()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1343:31: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::SendAsync(std::string, IoTHubMessage&, boost::python::api::object&, boost::python::api::object&)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1354:13: error: 'sendCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1361:44: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1361:126: error: 'sendCompleteContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubMessaging::SetFeedbackMessageCallback(boost::python::api::object&, boost::python::api::object&)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1375:13: error: 'feedbackMessageContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1382:61: error: '_iothubMessagingHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1382:118: error: 'feedbackMessageContext' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: At global scope:
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1445:72: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1445:72: error: 'constexpr' needed for in-class initialization of static data member '_iothubServiceClientAuthHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1446:76: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1446:76: error: 'constexpr' needed for in-class initialization of static data member '_iothubDeviceMethodHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubDeviceMethod::IoTHubDeviceMethod(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1455:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1461:9: error: '_iothubDeviceMethodHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubDeviceMethod::IoTHubDeviceMethod(IoTHubServiceClientAuth)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1475:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1481:9: error: '_iothubDeviceMethodHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubDeviceMethod::Destroy()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1498:13: error: '_iothubDeviceMethodHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1504:13: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'IoTHubDeviceMethodResponse IoTHubDeviceMethod::Invoke(std::string, std::string, std::string, unsigned int)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1525:44: error: '_iothubDeviceMethodHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: At global scope:
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1590:72: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1590:72: error: 'constexpr' needed for in-class initialization of static data member '_iothubServiceClientAuthHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1591:72: sorry, unimplemented: non-static data member initializers
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1591:72: error: 'constexpr' needed for in-class initialization of static data member '_iothubDeviceTwinHandle' of non-integral type
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubDeviceTwin::IoTHubDeviceTwin(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1600:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1606:9: error: '_iothubDeviceTwinHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In constructor 'IoTHubDeviceTwin::IoTHubDeviceTwin(IoTHubServiceClientAuth)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1620:9: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1626:9: error: '_iothubDeviceTwinHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'void IoTHubDeviceTwin::Destroy()':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1643:13: error: '_iothubDeviceTwinHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1649:13: error: '_iothubServiceClientAuthHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'std::string IoTHubDeviceTwin::GetTwin(std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1664:45: error: '_iothubDeviceTwinHandle' was not declared in this scope
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp: In member function 'std::string IoTHubDeviceTwin::UpdateTwin(std::string, std::string)':
/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:1687:48: error: '_iothubDeviceTwinHandle' was not declared in this scope

AMQP transport failed to establish connection with service.

I have written a simple Python script with the following logic, summary it initiated the iothub_client once and loops forever. After some time, it seems to stop working, presumably when the authentication (using "iotHubClient = IoTHubClient(connection_string, protocol)" and the AMQP protocol) needs regenerate a SAS token.

Other than running "iotHubClient = iothub_client_init()", which seems inefficient, I suggest that the Python code not have to worry about it and the C code try to re-authenticate.

def main():
    global iotHubClient, UDP_IP, UDP_PORT

   
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.bind((UDP_IP, UDP_PORT))

        iotHubClient = iothub_client_init()

        while True:
            data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
            data = data.replace('\r\n', '')
            try:
              UDPMessage = data.split(':')
              if UDPMessage[0] == "TempUpdate":
                message = '{ "event": "%s", "sensor": "%s", "temperature": %3.2f}' % (UDPMessage[0], UDPMessage[1], float(UDPMessage[2]))
                print message
                IoTmessage = IoTHubMessage(bytearray(str(message), 'utf8'))
                iotHubClient.send_event_async(IoTmessage, send_confirmation_callback, message)
            except:
              print data
            
    except IoTHubError as e:
        print("Unexpected error %s from IoTHub" % e)
        return
    except KeyboardInterrupt:
        print("IoTHubClient sample stopped")``


**Error I am seeing:**

Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:364 Failure: select failure.
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:establishConnection Line:643 Failed to open the connection with CBS.
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:IoTHubTransportAMQP_DoWork Line:1351 AMQP transport failed to establish connection with service.
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp_auth.c Func:authentication_reset Line:637 Failed to reset the authentication state (authentication status is invalid: 2)
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:prepareDeviceForConnectionRetry Line:1080 Failed resetting the authenticatication state of device
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp_methods.c Func:iothubtransportamqp_methods_unsubscribe Line:719 unsubscribe called while not subscribed
Error: Time:Tue Feb 21 06:40:02 2017 File:/root/iot/azure-iot-sdks/c/iothub_client/src/iothubtransportamqp.c Func:destroyMessageReceiver Line:883 Failed closing the AMQP message receiver.

Build IoT SDK Python Samples failed in VS 2017

Hi,

I was trying to build python SDK on my windows 10 dev machine. I was not able to build the Python SDK samples even after i tried to upgrade the VS solutions to use VS 2017 latest build tools. when i execute a build using build.cmd i get the following error:

image

What are the packages need to be installed before running this script?

Please help me,

What are the packages need to be installed before running this script?

Because, when run the script I get this error,

ModuleNotFoundError Traceback (most recent call last)
in ()
11 from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResult
12 from iothub_client import IoTHubMessage, IoTHubMessageDispositionResult, IoTHubError, DeviceMethodReturnValue
---> 13 from iothub_client_args import get_iothub_opt, OptionError
14
15 # HTTP options

ModuleNotFoundError: No module named 'iothub_client_args'

I only have these packages at the moment

  1. azure_iothub_device_client
  2. azure_iothub_service_client

Thanks

./setup.sh: line 13: ./c/build_all/linux/setup.sh: No such file or directory

  • OS and version used: Linux 6d8edc4b4e3f 4.9.13-moby #1 SMP Sat Mar 25 02:48:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux (Docker ubuntu image)

  • Python runtime used: python2.7.2

  • SDK version used: latest download

Description of the issue:

Im trying to setup the env and inside the folder build_all/linux i tried to run the command ./setup.sh but get the following error.

python: can't open file 'version': [Errno 2] No such file or directory

Code sample exhibiting the issue:

Console log of the issue:

(bossa) docker@6d8edc4b4e3f:~/bossa/azure-iot-sdk-python/build_all/linux$ python version
python: can't open file 'version': [Errno 2] No such file or directory

Error when running the IoT Hub Client Sample

I am trying to run one of the samples of this repo (iothub_client_sample_class.py) but I am constantly running into these errors:

Error: Time:Mon Jul 24 15:40:00 2017 File:C:\Users\zolvarga\Documents\WindowsPowerShell\Modules\aziotsdk_pytools\src\c\c-utility\adapters\socketio_win32.c Func:socketio_open Line:306 Failure: connect failure 10060.
Error: Time:Mon Jul 24 15:40:00 2017 File:C:\Users\zolvarga\Documents\WindowsPowerShell\Modules\aziotsdk_pytools\src\c\c-utility\src\tlsio_schannel.c Func:send_chunk Line:413 invalid tls_io_instance->tlsio_state: TLSIO_STATE_NOT_OPEN
Error: Time:Mon Jul 24 15:40:00 2017 File:C:\Users\zolvarga\Documents\WindowsPowerShell\Modules\aziotsdk_pytools\src\c\c-utility\src\tlsio_schannel.c Func:internal_send Line:508 send_chunk failed
Error: Time:Mon Jul 24 15:40:00 2017 File:C:\Users\zolvarga\Documents\WindowsPowerShell\Modules\aziotsdk_pytools\src\c\c-utility\src\tlsio_schannel.c Func:tlsio_schannel_send Line:1256 send failed
Error: Time:Mon Jul 24 15:40:00 2017 File:C:\Users\zolvarga\Documents\WindowsPowerShell\Modules\aziotsdk_pytools\src\c\umqtt\src\mqtt_client.c Func:sendPacketItem Line:323 1257: Failure sending control packet data
Error: Time:Mon Jul 24 15:40:00 2017 File:C:\Users\zolvarga\Documents\WindowsPowerShell\Modules\aziotsdk_pytools\src\c\umqtt\src\mqtt_client.c Func:mqtt_client_disconnect Line:1097 Error: mqtt_client_disconnect send failed

I have tried a bunch of different things to make it work but I can't seem to get around this error. I am running Windows 10 (version 1703, build 15063.483) with Anaconda 4.3.14. I created an environment that contains the following packages:

> conda list
# packages in environment at C:\Users\sbran\Anaconda3\envs\azureiot:
#
azure-iothub-device-client 1.1.19.0                  <pip>
pip                       9.0.1                    py36_1
python                    3.6.2                         0
setuptools                27.2.0                   py36_1
vs2015_runtime            14.0.25420                    0
wheel                     0.29.0                   py36_0

Here's the command I ran:

python iothub_client_sample_class.py -c HostName=vrinno.azure-devices.net;DeviceId=device32e9473e376d4016a2e27fac9b81a6c8;SharedAccessKey=jmxJmbis7IXqLVUTPBmyVogNyvRnEff/Gb198Z08IMg= -p MQTT

Note: The connection string above was just for a test device that I have deleted before posting this issue.

I both tried cloning the entire repository and running the sample from within the samples directory as well as downloading the three necessary files individually. Neither approach seems to work.

I am quite confused about the reference to the C:\Users\zolvarga\Documents directory printed in the output. This directory does not exist on my computer but it seems like it might on one of your developers' PCs (@zolvarga). How can this sort of reference sneak into production code? I don't understand that.

I hope you can help me debug this issue. Please let me know if you need any other diagnostics output from me.

Module object has no attribute __version__

  • Windows 7 Pro 64-bit

  • Python 2.7.13 and 3.6.1

  • Unknown

Hi Guys,

After using both 2.7.13 and 3.6.1 and installing by python -m pip install azure-iothub-device-client and trying to run the sample, I get the following error message:

...Desktop\azure-iot-sdk-python\device\samples>python iothub_client_sample.py

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]
Traceback (most recent call last):
  File "iothub_client_sample.py", line 221, in <module>
    print ( "IoT Hub for Python SDK Version: %s" % iothub_client.__version__ )
AttributeError: 'module' object has no attribute '__version__'

It's the same message for both versions of Python.
Am I doing something fundamentally wrong?

Python HTTP Protocol Not Working for receiving messages.

From @asebak on December 3, 2016 22:45

When using AMQP the python library works fine for both sending and receiving messages. When using HTTP and configuring with a timeout and minimum polling period, messages are not received. I didn't set any certificates so not sure if that could be an issue from my side.

Copied from original issue: Azure/azure-iot-sdks#1011

Unable to find remote helper for 'https'

Hi I've been following the instructions to run the python samples that connect with Azure IoT Hub using an Arduino YUN. When I execute this line:

git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git

I always get this answer: "fatal: Unable to find remote helper for 'https' "

If I use "git" instead "https" it runs, but fails while it is cloning, this is the output taken from Putty:

root@FCP:~# git clone --recursive git://github.com/Azure/azure-iot-sdk-python.git
Cloning into 'azure-iot-sdk-python'...
remote: Counting objects: 36082, done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 36082 (delta 15), reused 0 (delta 0), pack-reused 36031
Receiving objects: 100% (36082/36082), 39.13 MiB | 263 KiB/s, done.
Resolving deltas: 100% (21810/21810), done.
Checking out files: 100% (87/87), done.
git: 'sh-i18n--envsubst' is not a git command. See 'git --help'.
git: 'sh-i18n--envsubst' is not a git command. See 'git --help'.

Cloning into 'c'...
fatal: Unable to find remote helper for 'https'
git: 'sh-i18n--envsubst' is not a git command. See 'git --help'.
git: 'sh-i18n--envsubst' is not a git command. See 'git --help'.

Do I need to install some package in order to to find remote helper for 'https'???

deviceId is not found

  • OS and version used: RASPBIAN JESSIE LITE

  • Python runtime used: Python 2.7.9

  • SDK version used: release_2017_06_16

Description of the issue:

Running the sample i get the error deviceID not found, i checked it with the Device Explorer and also getting the connection string from the azure portal

Code sample exhibiting the issue:

python iothub_client_sample.py -c CONNECTIONSTRING -p mqtt
python iothub_client_sample.py -c SECUNDARYCONNECTIONSTRING -p mqtt
python iothub_client_sample.py -c CONNECTIONSTRING -p https
python iothub_client_sample.py -c SECUNDARYCONNECTIONSTRING -p https

Console log of the issue:

Info: IoT Hub SDK for C, version 1.1.17
Error: Time:Thu Jun 29 01:26:32 2017 File:/home/pi/azureIOT/azure-iot-sdk-python/c/iothub_client/src/iothub_client_ll.c Func:IoTHubClient_LL_CreateFromConnectionString Line:672 deviceId is not found
Error: Time:Thu Jun 29 01:26:32 2017 File:/home/pi/azureIOT/azure-iot-sdk-python/c/iothub_client/src/iothub_client.c Func:create_iothub_instance Line:763 Failure creating iothub handle
Unexpected error IoTHubClient.IoTHubClient, IoTHubClientResult.ERROR from IoTHub

How device will get to know if i disable it from Azure iot hub UI?

  • OS and version used:

  • Python runtime used:

  • SDK version used:

Description of the issue:

Is there any callbacks or any event trigger when i disable device from Azure iot hub UI and from device side know, So i can take appropriate action on my physical device.

Code sample exhibiting the issue:

Console log of the issue:

Clone

Please do --recursive clone with the repo... Build and setup scripts will not work if you download zip file and run SDK

Unable to import client cert

Ubuntu 14.04
python 2.7
Master branch

I am unable to locate the following module which is referenced in the samples. I have built using the release.sh and installed into my venv

  from iothub_client_cert import CERTIFICATES

I can import the other modules, such as from iothub_client import IoTHubClient,

General Question - Threading Model

Is there any documentation concerning the threading model used by this sdk?

In particular I'm curious how the callbacks are serviced? Is there a single IO thread which is handling these callbacks? I am assuming that is what drives the use of global variables in the examples?

Are issues we should be aware of with the threading model and the GIL?

Thanks!

Getting "No module named iothub_client" error

  • Linux raspberrypi 4.4.50+ #970 Mon Feb 20 19:12:50 GMT 2017 armv6l GNU/Linux
  • Python 2.7.9
  • I don't see the SDK version anywhere. It is the current git code as of March 22, 2017

Description of the issue:

I followed these unix instructions (defaulted to python 2.7) to compile the SDK on my Pi: https://github.com/Azure/azure-iot-sdk-python/blob/master/doc/python-devbox-setup.md. When complete, I tried the sample:

python iothub_client_sample.py -c HostName=myhub.azure-devices.net;DeviceId=RaspberryPiZero;SharedAccessKey=MyKey -p amqp

I got an "ImportError: No module named iothub_client" error

I recompiled and see that I am getting an error with the compilation. I have attached the build log.
putty.log.txt

Code sample exhibiting the issue:

I used the iothub_client_sample.py file. I did not alter it.

Console log of the issue:

pi@raspberrypi:~/azure-iot-sdk-python/device/samples $ python iothub_client_sample.py -c HostName=myhub.azure-devices.net;DeviceId=RaspberryPiZero;SharedAccessKey=MyKey -p amqp
Traceback (most recent call last):
File "iothub_client_sample.py", line 10, in
import iothub_client
ImportError: No module named iothub_client
-bash: -p: command not found

azure_iothub_device_client for Raspbian Jessie is not found

Hi,

I was trying to run "iot_hub_client_sample.py" sample app from my Pi Zero. It seems that there is no build for Raspbian Jessie for his package. Is there any workaround for this?

image

I want to be able to run python apps that integrates with IoT Hub from my Pi Zero W device. Any direction is appreciate it.

Thanks.

Running iothub_client_sample_class with h flag causes error

I'm running the following on a raspberry pi and get an invalid syntax

pi@raspberrypi:~/azure-iot-sdk-python/device/samples $ python iothub_client_sample_class.py -h
  File "iothub_client_sample_class.py", line 158
    self._send_reported_state_callback, user_context)
       ^
SyntaxError: invalid syntax

Error when building Python SDK on RPi 2 (Raspbian)

Hi,
I'm trying to connect my Raspberry Pi 2 (running Raspbian Wheezy) to my MS IoT hub. Process:

  1. I first fetched the Python SDK to the Pie with:

git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git

The installed Python version is 2.7.3.

  1. Then I ran through the setup of the Python SDK successfully (including a cmake-3.2.2 update).

  2. Moved on to compiling the Python SDK by following this guide: https://github.com/Azure/azure-iot-sdk-python/blob/master/doc/python-devbox-setup.md#linux

Problem: The build gets stuck at 97% (see error printout below). The guide I linked to above actually describes that the build could get stuck at 98% (when building Python client library iothub_client.so) due to lack of memory. I checked this and yes, I had memory issues, so I increased the swapfile size to 1 GB as suggested in the guide. This increase of memory gives me some 100MB memory margin, but I still get the exact same error message at 97% (see the printout below).

Any tips or suggestions on how to get this resolved?

Error printout:
pi@raspberrypi ~/azure-iot-sdk-python/build_all/linux $ sudo ./build.sh ... ... [ 97%] Building CXX object python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o /home/pi/azure-iot-sdk-python/device/iothub_client_python/src/iothub_client_python.cpp:143:7: error: looser throw specifier for ‘virtual IoTHubError::~IoTHubError()’ /usr/include/c++/4.6/exception:65:13: error: overriding ‘virtual std::exception::~exception() throw ()’ python/src/CMakeFiles/iothub_client_python.dir/build.make:54: recipe for target 'python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o' failed make[2]: *** [python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o] Error 1 CMakeFiles/Makefile2:2418: recipe for target 'python/src/CMakeFiles/iothub_client_python.dir/all' failed make[1]: *** [python/src/CMakeFiles/iothub_client_python.dir/all] Error 2 Makefile:126: recipe for target 'all' failed make: *** [all] Error 2 pi@raspberrypi ~/azure-iot-sdk-python/build_all/linux $

Cheers!
Oscar

Error in sample from Windows

  • OS and version used: Windows 10

  • Python runtime used: Python 3.4.3

  • SDK version used: azure-iothub-device-client 1.1.16.0

Description of the issue:

I installed successfully through pip the azure-iothub-device-client (1.1.16.0) but when I try to import iothub_client (as in the samples given in the project) I get the error below.

Code sample exhibiting the issue:

import iothub_client

Console log of the issue:

C:\Python34\python.exe C:/[securePath]/main.py
Traceback (most recent call last):
File "C:/[securePath]/main.py", line 11, in
import iothub_client
File "C:\Python34\lib\site-packages\iothub_client_init_.py", line 1, in
from .iothub_client import *
ImportError: DLL load failed: The specified module could not be found.

Process finished with exit code 1

IoTHubClient.__init__ Boost.Python.ArgumentError: Python argument types did not match C++ signature:

Raspbian GNU/Linux 8, kernel: 4.4.50+
Python 2.7.9 has issue. Building for Python 3.4 and running with python3 works fine.
Compiled from git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git
Copied iothub_client.so from device samples folder to my own folder.
Tests all say OK when it built

Code:

self.iotClient = IoTHubClient(connString, IoTHubTransportProvider.AMQP_WS)
self.iotClient.set_option("messageTimeout", "5")

Console log of the issue:

Traceback (most recent call last):
File "test.py", line 9, in
a.stuff()
File "/root/stuff/stuff/init.py", line 65, in Stuff
self.stuff= IoTHubClient(connString, IoTHubTransportProvider.AMQP_WS)
Boost.Python.ArgumentError: Python argument types in
IoTHubClient.init(IoTHubClient, unicode, IoTHubTransportProvider)
did not match C++ signature:
init(_object*, std::string, IOTHUB_TRANSPORT_PROVIDER)

It looks like maybe there could be something left over from compiling or setting up, I did try a fresh git clone into a different folder and the issue persists.
I ran both setup.sh and build.sh.
Any step to clear this out?

PLAT_ARCH in linux release not working

UBUNTU 14.04
PYTHON 2.7
Master branch

In release.sh I was forced to change to PLAT_ARCH which is passed to --plat-name

Is this expected or an issue with my environment?

if [[ "$(uname -m)" = "x86_64" ]] ; then
    PLAT_ARCH="linux_x86_64"
else
    PLAT_ARCH="linux32"
fi

If I do not make the change I receive ... is not a supported wheel on this platform.

Yandex problem.

  • OS and version used:

  • Python runtime used:

  • SDK version used:

Description of the issue:

I'm living in Ukraine, and when i'm doing installation on Linux, it's trying to download headers hosted at yandex servers. But Yandex domain is blocked in Ukraine.

Code sample exhibiting the issue:

Console log of the issue:

certificates included in the samples stopped working

  • OS and version used:

  • Python runtime used:

  • SDK version used:

Description of the issue:

currently connect fails due to not working certificate.

Code sample exhibiting the issue:

any code

Console log of the issue:

c:InitializeConnection Line:1779 mqtt_client timed out waiting for CONNACK

azure-iot-sdk-python/c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_send Line:1236 Invalid tlsio_state. Expected state is TLSIO_STATE_OPEN.

azure-iot-sdk-python/c/umqtt/src/mqtt_client.c Func:sendPacketItem Line:323 1237: Failure sending control packet data

/c/umqtt/src/mqtt_client.c Func:mqtt_client_disconnect Line:1094 Error: mqtt_client_disconnect send failed
Segmentation fault

enhancement: minimal download-zip

Description of the issue:

Recursive download of this repo takes a long time. It would be fantastic if there was a possibility download a zip that includes all submodules, and no .git-directories.

Code sample exhibiting the issue:

Console log of the issue:

I tried running the script just replacing the connection string. I'm getting this error ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-4964bc94cead> in <module>() 11 from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResult 12 from iothub_client import IoTHubMessage, IoTHubMessageDispositionResult, IoTHubError, DeviceMethodReturnValue ---> 13 from iothub_client_args import get_iothub_opt, OptionError 14 15 # HTTP options ModuleNotFoundError: No module named 'iothub_client_args'

  • OS and version used:

  • Python runtime used:

  • SDK version used:

Description of the issue:

Code sample exhibiting the issue:

Console log of the issue:

Timeout not working as expected with MQTT

Ubuntu 14.04
Master Branch
Python 2.7.6

Protocol: MQTT

Timeouts are taking longer than I expect, in the example below my expectation is 5 seconds for timeout. I believe I am setting the timeout setting properly.

I am testing this by allowing the code to proceed all the way to the first print statement, where I have a breakpoint. I then disconnect my eth0 and wait for the timeout.

Code Snippet

        self.client.set_option("messageTimeout", 5)

        .....

        print time.time()
        self.client.send_event_async(event, send_confirmation_callback, 1)
        
        while WAITING_ON_RESPONSE:
            time.sleep(.250)

        print CONFIRMATION_RESULT
        if CONFIRMATION_RESULT == IoTHubClientConfirmationResult.MESSAGE_TIMEOUT:
            print "timeout"
            print time.time()

The log output

1496425120.14
MESSAGE_TIMEOUT
timeout
1496425242.05

iothub_client_sample_class.py segmentation fault

$ cd azure-iot-sdk-python/device/samples
azure-iot-sdk-python/device/samples

$ python iothub_client_sample_class.py
IoT Hub Client for Python
Info: IoT Hub SDK for C, version 1.1.16
Starting the IoT Hub Python sample using protocol MQTT...
IoTHubClient sending 5 messages
Segmentation fault (core dumped)

The iothub_client_sample.py script works. The environment includes the latest release of azure-iot-sdk-python on Fedora 25 with Python 2.7.13. The requisite connection string is embedded in the scripts. Debugging reveals:

(gdb) where
#0  0x00007ffff7781dd0 in pthread_mutex_lock () from /lib64/libpthread.so.0
#1  0x00007fffead7b969 in PR_Lock () from /lib64/libnspr4.so
#2  0x00007fffecff49f6 in nss_connect_common () from /lib64/libcurl.so.4
#3  0x00007fffecff27da in Curl_ssl_connect_nonblocking ()
   from /lib64/libcurl.so.4
#4  0x00007fffecfa7ef2 in https_connecting () from /lib64/libcurl.so.4
#5  0x00007fffecfb9ecc in Curl_protocol_connect () from /lib64/libcurl.so.4
#6  0x00007fffecfce5c6 in multi_runsingle () from /lib64/libcurl.so.4
#7  0x00007fffecfcf4d1 in curl_multi_perform () from /lib64/libcurl.so.4
#8  0x00007fffecfc58cd in curl_easy_perform () from /lib64/libcurl.so.4
#9  0x00007fffed5dccdd in HTTPAPI_ExecuteRequest ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#10 0x00007fffed5d9908 in HTTPAPIEX_ExecuteRequest ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#11 0x00007fffed5da492 in HTTPAPIEX_SAS_ExecuteRequest ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#12 0x00007fffed5748a1 in IoTHubClient_LL_UploadToBlob_step1and2 ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#13 0x00007fffed575a58 in IoTHubClient_LL_UploadToBlob_Impl ()
   from /home/c*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#14 0x00007fffed573c91 in IoTHubClient_LL_UploadToBlob ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#15 0x00007fffed56cdd4 in uploadingThread ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#16 0x00007fffed5d87a7 in ThreadWrapper ()
   from /home/*****/IoT/azure-iot-sdk-python/device/samples/iothub_client.so
#17 0x00007ffff777f6ca in start_thread () from /lib64/libpthread.so.0
#18 0x00007ffff6da9f7f in clone () from /lib64/libc.so.6

Pip freeze returns:

adal==0.4.5
astroid==1.4.5
async==0.6.1
azure==2.0.0
azure-batch==3.0.0
azure-common==1.1.6
azure-datalake-store==0.0.11
azure-graphrbac==0.30.0
azure-keyvault==0.3.4
azure-mgmt==1.0.0
azure-mgmt-authorization==0.30.0
azure-mgmt-batch==4.0.0
azure-mgmt-cdn==0.30.3
azure-mgmt-cognitiveservices==1.0.0
azure-mgmt-compute==1.0.0
azure-mgmt-containerregistry==0.2.1
azure-mgmt-datalake-analytics==0.1.4
azure-mgmt-datalake-nspkg==2.0.0
azure-mgmt-datalake-store==0.1.4
azure-mgmt-devtestlabs==2.0.0
azure-mgmt-dns==1.0.1
azure-mgmt-documentdb==0.1.3
azure-mgmt-iothub==0.2.2
azure-mgmt-keyvault==0.31.0
azure-mgmt-logic==2.1.0
azure-mgmt-monitor==0.2.1
azure-mgmt-network==1.0.0
azure-mgmt-nspkg==2.0.0
azure-mgmt-rdbms==0.1.0
azure-mgmt-redis==4.1.0
azure-mgmt-resource==1.1.0
azure-mgmt-scheduler==1.1.2
azure-mgmt-sql==0.5.3
azure-mgmt-storage==1.0.0
azure-mgmt-trafficmanager==0.30.0
azure-mgmt-web==0.32.0
azure-nspkg==2.0.0
azure-servicebus==0.21.1
azure-servicefabric==5.6.130
azure-servicemanagement-legacy==0.20.6
azure-storage==0.34.3
Babel==2.3.4
backports-abc==0.5
backports.functools-lru-cache==1.2.1
backports.shutil-get-terminal-size==1.0.0
backports.ssl-match-hostname==3.5.0.1
Beaker==1.5.4
beautifulsoup4==4.6.0
boto==2.45.0
Bottleneck==1.2.1
bunch==1.0.1
bz2file==0.98
bzr==2.7.0
cached-property==1.3.0
CCColUtils==1.4
CDDB==1.4
certbot==0.14.1
certifi==2017.4.17
cffi==1.7.0
chardet==2.3.0
Cheetah==2.4.4
click==6.7
climate==0.4.6
colorama==0.3.7
ConfigArgParse==0.11.0
configobj==5.0.6
configparser==3.5.0b2
coverage==4.4.1
cryptography==1.5.3
cssselect==0.9.2
cycler==0.10.0
decorator==4.0.11
DecoratorTools==1.8
di==0.3
Django==1.9.13
dnspython==1.15.0
docker-compose==1.9.0
docker-py==1.10.6
docker-pycreds==0.2.1
dockerfile-parse==0.0.5
dockerpty==0.4.1
docopt==0.6.2
downhill==0.4.0
dropbox==6.5.0
duplicity==0.7.12
ecdsa==0.13
egenix-mx-base==3.2.8
elasticsearch==2.3.0
enum34==1.0.4
ethtool==0.11
fedpkg==1.28
feedparser==5.2.0
file-magic==0.3.0
Flask==0.11.1
funcsigs==1.0.2
future==0.16.0
futures==3.1.1
gensim==0.13.4.1
geocode==0.1.0
gevent==1.2.2
gitdb2==2.0.0
GitPython==2.1.3
GnuPGInterface==0.3.2
gnuplot-py==1.8
gps==3.16
greenlet==0.4.12
gssapi==1.2.0
gyp==0.1
h2o==3.10.0.10
hl7==0.3.3
html5lib==0.999
httplib2==0.9.2
humanize==0.5.1
icalendar==3.9.0
idna==2.5
iniparse==0.4
ipaddr==2.1.10
ipaddress==1.0.16
IPy==0.81
ipykernel==4.5.0
ipython==5.1.0
ipython-genutils==0.1.0
isodate==0.5.4
isort==4.2.5
itsdangerous==0.24
iwlib==1.2
Jinja2==2.8.1
jsonpointer==1.10
jsonschema==2.5.1
jupyter-client==4.4.0
jupyter-core==4.1.0
Keras==1.2.1
kerberos==1.2.5
keyring==10.3.3
kitchen==1.2.4
langtable==0.0.36
Lasagne==0.1
lazy-object-proxy==1.2.1
lockfile==0.11.0
logilab-common==0.63.2
lxml==3.7.2
M2Crypto==0.25.1
Mako==1.0.6.dev0
MarkupSafe==0.23
matplotlib==1.5.2rc2
mccabe==0.2.1
memory-profiler==0.43
mercurial==3.8.1
mglob==0.4
mistune==0.7.3
mock==2.0.0
msrest==0.4.9
msrestazure==0.4.8
munch==2.0.4
mutagen==1.37
mysqlclient==1.3.7
ndg-httpsclient==0.4.0
neurolab==0.3.5
nltk==3.0.3
nose==1.3.7
ntplib==0.3.3
numexpr==2.6.1
numpy==1.12.0
oauthlib==2.0.2
offtrac==0.1.0
openidc-client==0.3.0
openlmi==0.6.0
ordered-set==2.0.0
osbs-client==0.33
packagedb-cli==2.14.1
pandas==0.19.2
pandas-datareader==0.2.1
paramiko==2.1.1
parsedatetime==2.1
Paste==2.0.3
path.py==5.2
pathlib2==2.1.0
patsy==0.4.1
pbr==1.10.0
pexpect==4.2.1
pickleshare==0.7.4
Pillow==3.4.2
plac==0.9.6
ply==3.8
policycoreutils-default-encoding==0.1
progress==1.2
prompt-toolkit==1.0.7
psutil==4.3.0
psycopg2==2.6.2
ptyprocess==0.5.1
pwquality==1.3.0
py2neo==2.0.8
pyasn1==0.2.3
pyasn1-modules==0.0.8
pycparser==2.14
pycrypto==2.6.1
pycryptopp==0.6.0.1206569328141510525648634803928199668821045408958
pycups==1.9.72
pycurl==7.43.0
pyenchant==1.6.8
PyGithub==1.29
Pygments==2.2.0
pygobject==3.22.0
pygpgme==0.3
pyinotify==0.9.6
PyJWT==1.5.0
pykickstart==2.32
pyliblzma==0.5.3
pylint==1.6.4
pyOpenSSL==16.2.0
pyparsing==2.1.10
pyparted==3.10.7
pyRFC3339==1.0
PySensors==0.0.3
PySocks==1.5.6
python-amazon-product-api==0.2.8
python-augeas==0.5.0
python-bugzilla==1.2.2
python-cloudfiles==1.7.11
python-dateutil==2.6.0
python-dmidecode==3.12.2
python-dotconf==0.2.1
python-fedora==0.9.0
python-ldap==2.4.25
python-meh==0.43
python-nss==1.0.0
python-sane==2.8.3
python-yubico==1.3.2
python2-pythondialog==3.3.0
pytz==2016.10
pyudev==0.21.0
pyusb==1.0.0
pywbem==0.10.0
pyxattr==0.5.3
PyXB==1.2.4
pyxdg==0.25
PyYAML==3.12
pyzmq==15.3.0
random2==1.0.1
rdf2csv==0.1.0
rdflib==4.1.2
redis==2.10.5
reportlab==3.3.0
repoze.lru==0.4
requests==2.10.0
requests-file==1.4
requests-kerberos==0.10.0
requests-oauthlib==0.8.0
rpkg==1.49
rpm-python==4.13.0.1
rsa==3.4.1
scdate==1.10.9
scikit-learn==0.18.1
scikit-neuralnetwork==0.7
scipy==0.18.1
sckdump==2.0.16
scour==0.35
scsamba==1.2.100
scsamba.dbus==1.2.100
scservices==0.111.4
scservices.dbus==0.111.4
SecretStorage==2.3.1
seobject==0.1
sepolicy==1.1
simplegeneric==0.8.1
simplejson==3.10.0
singledispatch==3.4.0.3
six==1.10.0
slip==0.6.4
slip.dbus==0.6.4
slip.gtk==0.6.4
smart-open==1.3.5
smmap2==2.0.1
spambayes==1.1b1
SQLAlchemy==1.0.17
SSSDConfig==1.15.2
statsmodels==0.6.1
systemd-python==232
tables==3.3.0
tabulate==0.7.7
Tempita==0.5.1
texttable==0.9.0
theanets==0.7.3
Theano==0.8.2
thrift==0.9.1
tornado==4.4.2
traitlets==4.3.1
typing==3.5.2.2
uniconvertor==2.0
Unidecode==0.4.16
urlgrabber==3.10.1
urllib3==1.15.1
wcwidth==0.1.7
websocket-client==0.37.0
Werkzeug==0.11.10
whelk==2.4
wrapt==1.10.10
wxPython==3.0.2.0
wxPython-common==3.0.2.0
xgboost==0.6a2
xlrd==0.9.4
xlwt==1.0.0
xml2json==0.1
yum-langpacks==0.4.5
yum-metadata-parser==1.1.4
zope.component==4.2.2
zope.event==4.2.0
zope.interface==4.2.0

Looking for Python sample code to get device historical messages from iothub

Hi,

I am working on a task to get historical D2C device messages from iothub with Python language. I wasn't able to find any helpful example code from internet. Can someone provide me some example code?

Closed issue Azure/azure-sdk-for-python#1131.

Thank you very much in advance!
Laura Chu

  • OS and version used:

  • Python runtime used:

  • SDK version used:

Description of the issue:

Code sample exhibiting the issue:

Console log of the issue:

Problem importing iothub_client in Windows

Hi,

I have just installed Python 3.6.0 in a Windows 10 machine.
I have then installed the iothub-client package using the command: pip install iothub-client
The installation completed successfully. However, when I try importing the package I get the following error:

import iothub_client
Traceback (most recent call last):
File "", line 1, in
File "C:\Python36-32\lib\site-packages\iothub_client_init_.py", line 1, in
from .iothub_client import *
ImportError: DLL load failed: The specified module could not be found.

Any help is much appreciated.
Thanks,
Pedro

Unable to build without AMQP and service client

  • OS and version used: Any

  • Python runtime used: 2.7

  • SDK version used: IoT Hub SDK for C, version 1.1.12

Description of the issue:

Build error when disabling AMQP and service client support. An example scenario where disabling those might be wanted is when building on a Raspberry Pi and just wanting to use the device client with MQTT.

Code sample exhibiting the issue:

Example cmake flags that trigger the issue:

cmake -Drun_valgrind:BOOL=OFF -DcompileOption_CXX:STRING="-Wno-unused-value" -DcompileOption_C:STRING="-Wno-unused-value" -Drun_e2e_tests:BOOL=OFF -Drun_longhaul_tests=OFF -Duse_amqp:BOOL=OFF -Duse_http:BOOL=ON -Duse_mqtt:BOOL=ON -Ddont_use_uploadtoblob:BOOL=OFF -Duse_wsio:BOOL=ON -Drun_unittests:BOOL=OFF -Dbuild_python:STRING=2.7 -Dbuild_javawrapper:BOOL=OFF -Dno_logging:BOOL=OFF -Dskip_samples=ON -DPYTHON_INCLUDE_DIR=$(python-config --prefix)/include/python2.7 -DPYTHON_LIBRARY=$(python-config --prefix)/lib/libpython2.7.dylib ../..

Console log of the issue:

The issue is two-fold.

The first error is:

Scanning dependencies of target iothub_client_python
[ 96%] Building CXX object python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o
/home/pi/azure-iot-sdk-python/device/iothub_client_python/src/iothub_client_python.cpp: In static member function ‘static const TRANSPORT_PROVIDER* (* IoTHubClient::GetProtocol(IOTHUB_TRANSPORT_PROVIDER))()’:
/home/pi/azure-iot-sdk-python/device/iothub_client_python/src/iothub_client_python.cpp:1090:14: error: ‘AMQP_WS’ was not declared in this scope
         case AMQP_WS:
              ^
/home/pi/azure-iot-sdk-python/device/iothub_client_python/src/iothub_client_python.cpp:1091:24: error: ‘AMQP_Protocol_over_WebSocketsTls’ was not declared in this scope
             protocol = AMQP_Protocol_over_WebSocketsTls;
                        ^
python/src/CMakeFiles/iothub_client_python.dir/build.make:62: recipe for target 'python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o' failed
make[2]: *** [python/src/CMakeFiles/iothub_client_python.dir/iothub_client_python.cpp.o] Error 1
CMakeFiles/Makefile2:1366: recipe for target 'python/src/CMakeFiles/iothub_client_python.dir/all' failed
make[1]: *** [python/src/CMakeFiles/iothub_client_python.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

And after above fixed, the second is:

[ 96%] Built target iothub_client_mock
Scanning dependencies of target iothub_service_client_python
[ 97%] Building CXX object python_service_client/src/CMakeFiles/iothub_service_client_python.dir/iothub_service_client_python.cpp.o
azure-iot-sdk-python/service/src/iothub_service_client_python.cpp:23:10: fatal error: 'iothub_sc_version.h' file not found
#include "iothub_sc_version.h"
         ^
1 error generated.

How to get message id in amqps

In the https implementation there's a header: iothub-messageid when you receive a message. How do I get this in the amqp implementation when I receive a message.

Unable to build in mac

I am unable to build the library in mac

(azure-iot) Akhils-MacBook-Air:mac akhilputhiry$ 
(azure-iot) Akhils-MacBook-Air:mac akhilputhiry$ pwd
/Users/akhilputhiry/Dev/azure-iot-sdk-python/build_all/mac
(azure-iot) Akhils-MacBook-Air:mac akhilputhiry$ ./build.sh 
Build root: /Users/akhilputhiry/Dev/azure-iot-sdk-python
Build folder: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac
~/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac ~/Dev/azure-iot-sdk-python
CMake Error: The source directory "/Users/akhilputhiry/Dev/azure-iot-sdk-python/c" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
make: *** No targets specified and no makefile found.  Stop.
Test project /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac
No tests were found!!!
~/Dev/azure-iot-sdk-python
copy iothub_client library to samples folder
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python/src/iothub_client.dylib: No such file or directory
copy iothub_client_mock library to tests folder
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python/test/iothub_client_mock.dylib: No such file or directory
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python/src/iothub_client.dylib: No such file or directory
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python_service_client/src/iothub_service_client.dylib: No such file or directory
copy iothub_service_client library to samples folder
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python_service_client/src/iothub_service_client.dylib: No such file or directory
copy iothub_service_client_mock library to tests folder
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python_service_client/tests/iothub_service_client_mock.dylib: No such file or directory
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python_service_client/src/iothub_service_client.dylib: No such file or directory
cp: /Users/akhilputhiry/Dev/azure-iot-sdk-python/c/cmake/iotsdk_mac/python/src/iothub_client.dylib: No such file or directory
python2.7 iothub_client_ut.py
Traceback (most recent call last):
  File "iothub_client_ut.py", line 9, in <module>
    import iothub_client_mock
ImportError: No module named iothub_client_mock
(azure-iot) Akhils-MacBook-Air:mac akhilputhiry$ 

some problems with the cross-compile of azure-iot-sdk-python

#- OS and version used:
host:Linux version 3.13.0-32-generic
taget:openwrt 10.03, mtk7621
gcc:toolchain-mipsel_gcc-4.6

#- Python runtime used:
python2.7: ELF 32-bit LSB executable, MIPS, MIPS32 version 1

- SDK version used:
azure-iot-sdk-python

#- Description of the issue:
Hi, I encountered some problems with the cross compile of azure-iot-sdk-python. When I compile the sdk on host system and not cross-compile, everything goes well. But, it always throws me errs:

-- Could NOT find Boost
-- Found PythonLibs: /home/wusc/R200/package/azure-iot/output/Python-2.7.12/lib/libpython2.7.a (found suitable version "2.7.12", minimum required is "2.7")
-- Could NOT find Boost
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (found suitable version "2.7.12", minimum required is "2.7")
CMake Warning at CMakeLists.txt:268 (message):
This package may only be installed when 'use_installed_dependencies' is ON

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PYTHON_LIBRARY (ADVANCED)
linked by target "iothub_service_client_python" in directory /home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src
linked by target "iothub_service_client_mock" in directory /home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/tests

# Code sample exhibiting the issue:
wusc@ff-compiler:~/azure-iot-sdk-python/build_all/linux$ ./build.sh --toolchain-file toolchain-openwrt.cmake -cl -ldl

# Console log of the issue:
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /home/wusc/R200/package/azure-iot/OpenWrt-Toolchain-mtk762x-for-mipsel-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc
-- Check for working C compiler: /home/wusc/R200/package/azure-iot/OpenWrt-Toolchain-mtk762x-for-mipsel-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/wusc/R200/package/azure-iot/OpenWrt-Toolchain-mtk762x-for-mipsel-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-c++
-- Check for working CXX compiler: /home/wusc/R200/package/azure-iot/OpenWrt-Toolchain-mtk762x-for-mipsel-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /home/wusc/R200/package/azure-iot/output/openssl-OpenSSL_1_0_2-stable/lib/libssl.a;/home/wusc/R200/package/azure-iot/output/openssl-OpenSSL_1_0_2-stable/lib/libcrypto.a
-- Shared_Util architecture: GENERIC
-- Performing Test CXX_FLAG_CXX11
-- Performing Test CXX_FLAG_CXX11 - Failed
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Checking for module 'libcurl'
-- Found libcurl, version 7.35.0
-- Found CURL: curl
CMake Warning at uamqp/deps/umock-c/CMakeLists.txt:147 (message):
This package may only be installed when 'use_installed_dependencies' is ON

-- AMQP Target architecture: GENERIC
-- MQTT Target architecture: GENERIC
-- iothub architecture: GENERIC
-- Could NOT find Boost
-- Found PythonLibs: /home/wusc/R200/package/azure-iot/output/Python-2.7.12/lib/libpython2.7.a (found suitable version "2.7.12", minimum required is "2.7")
-- Could NOT find Boost
-- Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (found suitable version "2.7.12", minimum required is "2.7")
CMake Warning at CMakeLists.txt:268 (message):
This package may only be installed when 'use_installed_dependencies' is ON

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PYTHON_LIBRARY (ADVANCED)
linked by target "iothub_service_client_python" in directory /home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/src
linked by target "iothub_service_client_mock" in directory /home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/service/tests

-- Configuring incomplete, errors occurred!
See also "/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/c/cmake/iotsdk_linux/CMakeFiles/CMakeOutput.log".
See also "/home/wusc/R200/package/azure-iot/py2.7.12_x86/azure-iot-sdk-python/c/cmake/iotsdk_linux/CMakeFiles/CMakeError.log".

'IoTHubRegistryManager' is not defined

  • OS and version used:
    ubuntu 14.04
  • Python runtime used:
    python 3.4
  • SDK version used:
    latest clone

Description of the issue:

creating a device

Code sample exhibiting the issue:

import random
import time
import sys
import iothub_client
from iothub_client import IoTHubClient, IoTHubClientError, IoTHubTransportProvider, IoTHubClientResult
from iothub_client import IoTHubMessage, IoTHubMessageDispositionResult, IoTHubError, DeviceMethodReturnValue
from iothub_client_args import get_iothub_opt, OptionError

CONNECTION_STRING = "HostName=hubbysafweneful.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=fg6mJq8l2sy28a0e5Td/lHmW5s0Uo0pk9iGU3BgmXmY="
DEVICE_ID = "louel"

def print_device_info(title, iothub_device):
    print ( title + ":" )
    print ( "iothubDevice.deviceId                    = {0}".format(iothub_device.deviceId) )
    print ( "iothubDevice.primaryKey                  = {0}".format(iothub_device.primaryKey) )
    print ( "iothubDevice.secondaryKey                = {0}".format(iothub_device.secondaryKey) )
    print ( "iothubDevice.connectionState             = {0}".format(iothub_device.connectionState) )
    print ( "iothubDevice.status                      = {0}".format(iothub_device.status) )
    print ( "iothubDevice.lastActivityTime            = {0}".format(iothub_device.lastActivityTime) )
    print ( "iothubDevice.cloudToDeviceMessageCount   = {0}".format(iothub_device.cloudToDeviceMessageCount) )
    print ( "iothubDevice.isManaged                   = {0}".format(iothub_device.isManaged) )
    print ( "iothubDevice.authMethod                  = {0}".format(iothub_device.authMethod) )
    print ( "" )

def iothub_createdevice():
    try:
        iothub_registry_manager = IoTHubRegistryManager(CONNECTION_STRING)
        auth_method = IoTHubRegistryManagerAuthMethod.SHARED_PRIVATE_KEY
        new_device = iothub_registry_manager.create_device(DEVICE_ID, "", "", auth_method)
        print_device_info("CreateDevice", new_device)

    except IoTHubError as iothub_error:
        print ( "Unexpected error {0}".format(iothub_error) )
        return
    except KeyboardInterrupt:
        print ( "iothub_createdevice stopped" )


if __name__ == '__main__':
    print ( "" )
    print ( "Python {0}".format(sys.version) )
    print ( "Creating device using the Azure IoT Hub Service SDK for Python" )
    print ( "" )
    print ( "    Connection string = {0}".format(CONNECTION_STRING) )
    print ( "    Device ID         = {0}".format(DEVICE_ID) )

    iothub_createdevice()

Console log of the issue:

Python 3.4.3 (default, Nov 17 2016, 01:08:31) 
[GCC 4.8.4]
Creating device using the Azure IoT Hub Service SDK for Python

    Connection string = HostName=*******
    Device ID         =  **********
Traceback (most recent call last):
  File "p.py", line 47, in <module>
    iothub_createdevice()
  File "p.py", line 27, in iothub_createdevice
    iothub_registry_manager = IoTHubRegistryManager(CONNECTION_STRING)
NameError: name 'IoTHubRegistryManager' is not defined.


```How I set up my environment:
I cloned the repo, run setup.sh but it failed saying "./c/build_all/linux/setup.sh" is not found, I run git submodule update --init to download the contents of the c module and other modules, rerun `./setup.sh --python-version 3.4` ok, run ./`build.sh --build-python 3.4` ok.

Linux release script is broken

Ubuntu 14.04 LTS
Python 2.7.6
Running on master branch

----------------------------------------------------------------------
Ran 31 tests in 0.006s

OK
python2.7 iothub_service_client_map_test.py
test_IoTHubMap (__main__.TestIotHubMap) ... ok
test_IoTHubMapAddDelete (__main__.TestIotHubMap) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.011s

OK
running bdist_wheel
running build
running build_py
copying iothub_client/iothub_client.so -> build/lib.linux-x86_64-2.7/iothub_client
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/azure_iothub_device_client-1.1.14.0.data
creating build/bdist.linux-x86_64/wheel/azure_iothub_device_client-1.1.14.0.data/purelib
creating build/bdist.linux-x86_64/wheel/azure_iothub_device_client-1.1.14.0.data/purelib/iothub_client
copying build/lib.linux-x86_64-2.7/iothub_client/iothub_client.so -> build/bdist.linux-x86_64/wheel/azure_iothub_device_client-1.1.14.0.data/purelib/iothub_client
copying build/lib.linux-x86_64-2.7/iothub_client/__init__.py -> build/bdist.linux-x86_64/wheel/azure_iothub_device_client-1.1.14.0.data/purelib/iothub_client
running install_egg_info
running egg_info
creating azure_iothub_device_client.egg-info
writing azure_iothub_device_client.egg-info/PKG-INFO
writing top-level names to azure_iothub_device_client.egg-info/top_level.txt
writing dependency_links to azure_iothub_device_client.egg-info/dependency_links.txt
writing manifest file 'azure_iothub_device_client.egg-info/SOURCES.txt'
reading manifest file 'azure_iothub_device_client.egg-info/SOURCES.txt'
writing manifest file 'azure_iothub_device_client.egg-info/SOURCES.txt'
Copying azure_iothub_device_client.egg-info to build/bdist.linux-x86_64/wheel/azure_iothub_device_client-1.1.14.0.data/purelib/azure_iothub_device_client-1.1.14.0.egg-info
running install_scripts
Traceback (most recent call last):
  File "setup_device_client.py", line 55, in <module>
    distclass=BinaryDistribution
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 213, in run
    archive_basename = self.get_archive_basename()
  File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 161, in get_archive_basename
    impl_tag, abi_tag, plat_tag = self.get_tag()
  File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 155, in get_tag
    assert tag == supported_tags[0]
AssertionError
running bdist_wheel
running build
running build_py
copying iothub_service_client/iothub_service_client.so -> build/lib.linux-x86_64-2.7/iothub_service_client
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/azure_iothub_service_client-1.1.0.7.data
creating build/bdist.linux-x86_64/wheel/azure_iothub_service_client-1.1.0.7.data/purelib
creating build/bdist.linux-x86_64/wheel/azure_iothub_service_client-1.1.0.7.data/purelib/iothub_service_client
copying build/lib.linux-x86_64-2.7/iothub_service_client/__init__.py -> build/bdist.linux-x86_64/wheel/azure_iothub_service_client-1.1.0.7.data/purelib/iothub_service_client
copying build/lib.linux-x86_64-2.7/iothub_service_client/iothub_service_client.so -> build/bdist.linux-x86_64/wheel/azure_iothub_service_client-1.1.0.7.data/purelib/iothub_service_client
running install_egg_info
running egg_info
creating azure_iothub_service_client.egg-info
writing azure_iothub_service_client.egg-info/PKG-INFO
writing top-level names to azure_iothub_service_client.egg-info/top_level.txt
writing dependency_links to azure_iothub_service_client.egg-info/dependency_links.txt
writing manifest file 'azure_iothub_service_client.egg-info/SOURCES.txt'
reading manifest file 'azure_iothub_service_client.egg-info/SOURCES.txt'
writing manifest file 'azure_iothub_service_client.egg-info/SOURCES.txt'
Copying azure_iothub_service_client.egg-info to build/bdist.linux-x86_64/wheel/azure_iothub_service_client-1.1.0.7.data/purelib/azure_iothub_service_client-1.1.0.7.egg-info
running install_scripts
Traceback (most recent call last):
  File "setup_service_client.py", line 55, in <module>
    distclass=BinaryDistribution
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 213, in run
    archive_basename = self.get_archive_basename()
  File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 161, in get_archive_basename
    impl_tag, abi_tag, plat_tag = self.get_tag()
  File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 155, in get_tag
    assert tag == supported_tags[0]
AssertionError

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.