ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
442 stars 62 forks source link

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

Closed slishak closed 1 year ago

slishak commented 1 year ago

Checklist:

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:

ironsheep commented 1 year ago

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 commented 1 year ago

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

upamanyudas commented 8 months ago

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