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

shadow.py example - No module named 'command_line_utils'

1960pghpirates opened this issue · 10 comments

Describe the bug

I am trying to run the shadow.py example, but am getting an error related to command_line_utils.

ModuleNotFoundError: No module named 'command_line_utils'

I am having a problem importing this module directly. Is there another library that I am missing? I am running the latest versions of awscrt (0.14.6) and awsiot (0.1.3) and Python 3.7.3.

https://github.com/aws/aws-iot-device-sdk-python-v2/blob/main/samples/shadow.py

Expected Behavior

Python interpreter should import command_line_utils.

Current Behavior

Error being produced: ModuleNotFoundError: No module named 'command_line_utils'

Reproduction Steps

Run the shadow.py example using Python 3.7.3.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.11.8

Environment details (OS name and version, etc.)

Raspberry Pi Zero WH

The command_line_utils is just a helper file for the samples to handle to command line arguments that you are running the example with:

python3 shadow.py --endpoint <endpoint> --ca_file <file> --cert <file> --key <file> --thing-name <name>

This should be running without and errors. What steps are you taking to install/run this sdk?

@jmklix I followed the instructions on GitHub page and it looks like I already have the latest packages installed.

pi@raspberrypi:~ $ python3 -m pip install awsiotsdk
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: awsiotsdk in ./.local/lib/python3.7/site-packages (1.11.8)
Requirement already satisfied: awscrt==0.14.6 in ./.local/lib/python3.7/site-packages (from awsiotsdk) (0.14.6)

Are you still running into the error when running the sample?

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.

@jmklix Yes, I am still getting the error when running the shadow sample.

pi@raspberrypi:~ $ python3 shadow.py
Traceback (most recent call last):
  File "shadow.py", line 32, in <module>
    import command_line_utils;
ModuleNotFoundError: No module named 'command_line_utils'
pi@raspberrypi:~ $ python shadow.py
Traceback (most recent call last):
  File "shadow.py", line 32, in <module>
    import command_line_utils;
ModuleNotFoundError: No module named 'command_line_utils'
pi@raspberrypi:~ $ 

Is there a file called command_line_utils.py in the same folder as the shadow.py sample file? You need both the sample you are wanting to run (shadow.py) and command_line_utils.py in order to run a sample because the command line utils file has a bunch of utility functions that are needed in the samples. Can you check if both files are present in the same folder?

@TwistedTwigleg I did not have the command_line_utils.py file in the same folder as shadow.py. I added it, and it is running as expected now. Thanks!

Awesome! I'm glad that fixed the problem 🙂
Closing this issue...

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.