louwrentius / showtools

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

AttributeError: 'str' object has no attribute 'decode' #10

Closed martijndierckx closed 3 years ago

martijndierckx commented 3 years ago

Downloaded the latest version of your scripts. But I'm getting a decoding error. show disk -mSs works but once I start requesting extra things like temp etc, the script returns an error.

Any ideas?

Setup:

$ sudo showtools-1.0.1/show disk -mSsftHrRP
Traceback (most recent call last):
  File "showtools-1.0.1/show", line 765, in <module>
    main()
  File "showtools-1.0.1/show", line 165, in main
    devicedata = process_device(device, args)
  File "showtools-1.0.1/show", line 564, in process_device
    disktemp = get_parameter_from_smart(disksmart,
  File "showtools-1.0.1/show", line 367, in get_parameter_from_smart
    data = data.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
louwrentius commented 3 years ago

Thanks for your report. (Dag Martijn)

Would you mind sending me the smart data output of all drives?

for x in `ls -1 /dev/sd?`; do echo $x; smartctl -a $x; done > /tmp/smartoutput.txt

You can drop the smartoutput.txt as a file here.

Maybe my code is chocking on some (lack of) smart output. If no output is generated, you might want to add -d ata to the smartctl parameters. Many thanks in advance.

martijndierckx commented 3 years ago

Here you go smartoutput.txt

louwrentius commented 3 years ago

Thanks a lot, I suspect that it doesn't cope well with this section:

=== START OF INFORMATION SECTION === Vendor: VMware Product: Virtual disk

I'll try and fix the error handling.

louwrentius commented 3 years ago

I've created a branch 'development' with the fixed code. I believe I resolved the issue, but you'll be the judge of that.

martijndierckx commented 3 years ago

That did it!

Thanks for the swift response!