Skip to content

Issue using aws-iot-device-sdk-python-v2 with tutorial on amazon docs #360

Closed
@allangagnon

Description

@allangagnon

Describe the bug

I have been working on this Tutorial:https://docs.aws.amazon.com/iot/latest/developerguide/lightbulb-shadow-application.html
it seems that 5 days ago the Sample.py was changed and now does not seem to be working correctly.

Expected Behavior

After running the following command:
python3 shadow.py --ca_file ~/certs/Amazon-root-CA-1.pem --cert ~/certs/device.pem.crt --key ~/certs/private.pem.key --endpoint your-iot-endpoint --thing_name your-iot-thing-name

With the proper endpoint and thing_name I would expect the terminal window to produce the following text and then expect an input:

Connected!
Subscribing to Update responses...
Subscribing to Get responses...
Subscribing to Delta events...
Requesting current shadow state...
Launching thread to read user input...
Finished getting initial shadow state.
Shadow contains reported value 'blue'.
Enter desired value:

Current Behavior

I get the following error:
Traceback (most recent call last):
File “/home/afg/src/aws-iot-device-sdk-python-v2/samples/shadow.py”, line 279, in user_input_thread_fn
new_value = input()
UnboundLocalError: local variable ‘input’ referenced before assignment

Reproduction Steps

Install the current AWS IoT Device SDK for Python

Install the AWS IoT Device SDK for Python and download the sample apps to your device.

On your device, run these commands.

cd ~
python3 -m pip install awsiotsdk

git clone https://github.com/aws/aws-iot-device-sdk-python-v2.git

Then run this command on the device you are using for this tutorial:

python3 shadow.py --ca_file ~/certs/Amazon-root-CA-1.pem --cert ~/certs/device.pem.crt --key ~/certs/private.pem.key --endpoint your-iot-endpoint --thing_name your-iot-thing-name

Possible Solution

Traceback (most recent call last):
File “/home/afg/src/aws-iot-device-sdk-python-v2/samples/shadow.py”, line 279, in user_input_thread_fn
new_value = input()
UnboundLocalError: local variable ‘input’ referenced before assignment

In the new shadow.py that was updated 5 days ago the code has changed and is not working, if I download the older version the file shadow.py works.

Additional Information/Context

No response

SDK version used

1 parent 86f2503 commit 399c6a3

Environment details (OS name and version, etc.)

macOS Monterey version 12.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.pending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions