truenas / py-SMART

Wrapper for smartctl (smartmontools)
GNU Lesser General Public License v2.1
79 stars 35 forks source link

device.py:1181: TypeError: unsupported operand type(s) for /: 'int' and 'NoneType' #61

Closed ulmitov closed 1 year ago

ulmitov commented 1 year ago

Hi,

Got this type error when calling run_selftest_and_wait, probably python 3.9 issue


/usr/local/lib/python3.9/site-packages/pySMART/device.py:854: in run_selftest_and_wait
    test_initiation_result = self.run_selftest(test_type)
/usr/local/lib/python3.9/site-packages/pySMART/device.py:761: in run_selftest
    self.get_selftest_result()
/usr/local/lib/python3.9/site-packages/pySMART/device.py:672: in get_selftest_result
    self.update()

            if 'Accumulated start-stop cycles' in line:
                self.diagnostics.Start_Stop_Cycles = int(
                    line.split(':')[1].strip())
                if self.diagnostics.Start_Stop_Spec != 0:
                    self.diagnostics.Start_Stop_Pct_Left = int(round(
>                       100 - (self.diagnostics.Start_Stop_Cycles /
                               self.diagnostics.Start_Stop_Spec), 0))
E                   TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'
/usr/local/lib/python3.9/site-packages/pySMART/device.py:1181: TypeError
ralequi commented 1 year ago

Hi @ulmitov ,

What you are looking at seems to be fixed on #57 / 77b201c3d5872dee7240f2a27e7a9ea62e32e9d2 .

Could you please try development branch? If you confirm this is fixed there, I'll release a new version with it tomorrow (or even today if you are quick)

ulmitov commented 1 year ago

Ah, gotcha, i will wait for the next version release, thanks!

ralequi commented 1 year ago

Release in progress