>>> import subprocess
>>> subprocess.check_output("smartctl -d ata -a /dev/sda", shell=True)
"output of above command prints normally"
>>> subprocess.check_output("smartctl -d ata -a /dev/sdb", shell=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'smartctl -d ata -a /dev/sdb' returned non-zero exit status 64
Can anyone explain to me why the above command with sda works fine but returns an error with sdb? sdc works too, for the record. Also, I am aware of the risk of using shell=True. I am learning python and ran into this problem while writing a test script.