Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid literal for int() with base 10: 'address' #61

Closed
slishak opened this issue Jul 25, 2022 · 3 comments
Closed

Invalid literal for int() with base 10: 'address' #61

slishak opened this issue Jul 25, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@slishak
Copy link

slishak commented Jul 25, 2022

Checklist:

  • I updated to the latest version available
  • I checked that my MQTT broker is otherwise working

Release with the issue: 1.6.0

Last working release (if known): N/A

Hardware, Operating System, Python version:

Raspberry Pi 4 Model B Rev 1.5, 2GB RAM
Buster 5.10.103-v7l+

Description of problem:

The script fails due to the following error:

[2022-07-25 08:43:30] - (DBG): getFileSystemDrives() trimmedLines=[['/bin/df: /mnt/sabrent: No such device or address', '/dev/root         119756  19503     95346  17% /', '/dev/sda1         953868 882178     71690  93% /media/usb0', '/dev/sdb1         976761  93684    883078  10% /media/pi/SSD']]
[2022-07-25 08:43:30] - (DBG): lineParts(7)=[['/bin/df:', '/mnt/sabrent:', 'No', 'such', 'device', 'or', 'address']]
[2022-07-25 08:43:30] - (DBG): percent_field_index=[2]
[2022-07-25 08:43:30] - (DBG): device=[/bin/df: /mnt/sabrent:]
[2022-07-25 08:43:30] - (DBG): mount_point=[such device]
Traceback (most recent call last):
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 957, in <module>
    getFileSystemDrives()
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 696, in getFileSystemDrives
    next_power_of_2(lineParts[total_size_idx]))
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 715, in next_power_of_2
    size_as_nbr = int(size) - 1
ValueError: invalid literal for int() with base 10: 'address'

Probably due to the drive in /mnt/sabrent not being mounted correctly.

Run our report script 'genBugInfo' on your failing device and include the output here:

Not included for privacy, will add if strictly necessary

Python errors shown in the logs (if applicable):

Traceback (most recent call last):
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 957, in <module>
    getFileSystemDrives()
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 696, in getFileSystemDrives
    next_power_of_2(lineParts[total_size_idx]))
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 715, in next_power_of_2
    size_as_nbr = int(size) - 1
ValueError: invalid literal for int() with base 10: 'address'

Additional information:

@slishak slishak added the bug Something isn't working label Jul 25, 2022
@ironsheep
Copy link
Owner

OK, you maybe don't have one of your mounts active?

The output shows: /mnt/sabrent: No such device or address

I'm adding a filter for "No such device" so we don't get an error in this case any longer.
A warning will be issued from the script if this is actually seen.

@ironsheep ironsheep self-assigned this Aug 17, 2022
ironsheep added a commit that referenced this issue Aug 17, 2022
- (#63) Fix path to cut(1) command
- (#61) add filter to prevent df reporting "No such device or address" from breaking the script
@ironsheep
Copy link
Owner

This fix has been committed and will appear in versions v1.6.2 and later.

@upamanyudas
Copy link

upamanyudas commented Oct 27, 2023

Hi
getting a similar error:

Traceback (most recent call last):
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 1212, in <module>
    getFileSystemDrives()
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 913, in getFileSystemDrives
    next_power_of_2(lineParts[total_size_idx]))
  File "/opt/RPi-Reporter-MQTT2HA-Daemon/ISP-RPi-mqtt-daemon.py", line 932, in next_power_of_2
    size_as_nbr = int(size) - 1
ValueError: invalid literal for int() with base 10: 'Drive'

Attaching the BugInfo file here as well:

genBugInfo-231027-204036.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants