aws / aws-iot-device-sdk-python-v2

Next generation AWS IoT Client SDK for Python using the AWS Common Runtime
Apache License 2.0
408 stars 213 forks source link

awscrt.io has no attribute 'Pkcs11Lib' #280

Closed ksbains closed 2 years ago

ksbains commented 2 years ago

Confirm by changing [ ] to [x] below:

Platform/OS/Device Raspberry Pi Model 3B+

Describe the question I tried running the pubsub sample app and got the following AttributeError: module 'awscrt.io' has no attribute 'Pkcs11Lib'

jmklix commented 2 years ago

Which version of this sdk are you using and how did you install it?

Install from PyPI

python3 -m pip install awsiotsdk

Install from source

git clone https://github.com/aws/aws-iot-device-sdk-python-v2.git
python3 -m pip install ./aws-iot-device-sdk-python-v2
ksbains commented 2 years ago

I cloned the repo, but I installed the sdk using pip install awsiotsdk. I do not see the file 'aws-iot-device-sdk-python-v2' in the repo.

jmklix commented 2 years ago

'aws-iot-device-sdk-python-v2' is the parent folder that you download when cloning the repo

Are trying to run pubsub.py or pkcs11_pubsub.py?

ksbains commented 2 years ago

I am trying to run 'pubsub.py'. I run it by the following line: python3 pubsub.py --topic topic_1 --root-ca ~/certs/Amazon-root-CA-1.pem ~/certs/certificate.pem.crt --key ~/cert/private.pem.key --endpoint #myEndpointHere#-ats.iot.us-west-2.amazonaws.com

ksbains commented 2 years ago

The full error is this: File "pubsub.py", line 6 in from awsiot import mqtt_connection_builder File "/usr/local/lib/python3.7/dist-packages/awsiot/mqtt_connection_builder.py", line 259, in cert_bytes=None, AttributeError: module 'awscrt.io' has not attribute 'Pkcs11Lib'

jmklix commented 2 years ago

It looks like you are missing --cert when you are trying to run the example. This is what I think it should look like for you given all of the paths/files are correct

python3 pubsub.py --topic topic_1 --root-ca ~/certs/Amazon-root-CA-1.pem --cert ~/certs/certificate.pem.crt --key ~/cert/private.pem.key --endpoint #myEndpointHere#-ats.iot.us-west-2.amazonaws.com
github-actions[bot] commented 2 years ago

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.