louwrentius / showtools

Shows detailed disk or network device information
BSD 3-Clause "New" or "Revised" License
122 stars 17 forks source link

invalid literal for int() with base 10: 'Inc.' on debian #5

Closed ackackack closed 9 years ago

ackackack commented 9 years ago

When running the following output is received:

Traceback (most recent call last):
  File "./show", line 691, in <module>
    main()
  File "./show", line 146, in main
    devicedata = process_device(device, args)
  File "./show", line 467, in process_device
    disksize = get_disk_size(dev)
  File "./show", line 292, in get_disk_size
    gb = int(bytes) / 1000000000
ValueError: invalid literal for int() with base 10: 'Inc.'

I've narrowed this down to the fdisk execution. on my test debian test system the fdisk version is GNU Fdisk 1.2.4 When this is run the short GNU license is printed to stdout and the second line printed is:

Copyright (C) 1998 - 2006 Free Software Foundation, Inc.

I can patch around this by crudely amending the fdisk command to the following:

command = "fdisk -l /dev/" + device + "|grep 'Disk '"
louwrentius commented 9 years ago

Thanks for submitting this bug, I could not reproduce it as I don't have any kind of ancient fdisk at hand, but the patch does not break anything as far as I can tell.