-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Describe the bug
Running mqtt5_pubsub.py
with --count
raises:
TypeError: '<=' not supported between instances of 'int' and 'str' because the argument is parsed as a string instead of an integer.

Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
The script should parse --count as an integer and run without errors.
Current Behavior
When running mqtt5_pubsub.py with --count, the argument is parsed as a string instead of an integer.
This causes a TypeError when the code compares publish_count (int) with message_count (str).
Reproduction Steps
Run the script with a --count value:
python3 mqtt5_pubsub.py --count 5
and look out for the error raised.
Possible Solution
Update the argparse definition of --count to specify type=int, so that it is always parsed as an integer.
Additional Information/Context
This issue only occurs when using the --count argument because it was being parsed as a string.
A screenshot of the error is attached above for reference.
SDK version used
AWS IoT Device SDK for Python v2
Environment details (OS name and version, etc.)
OS: Ubuntu 22.04.5 LTS (Linux 6.8.0-60-generic) Python: 3.10.12 Architecture: x86_64