linux - Finding Volume Label of a usb mass storage device using python -


could please tell me how obtain usb mass storage device's volume label(the name displayed in explorer, not device name::/dev/sdx) using python? hal has deprecated please don't suggest option.

edit: there way using pyudev or pyusb??

if don't want use hal calling subprocess.

import subprocess  mounts = {}  line in subprocess.check_output(['mount', '-l']).split('\n'):     parts = line.split(' ')     if len(parts) > 2:         mounts[parts[2]] = parts[0]  print mounts 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -