I am running a test that includes mounting and unmounting a USB device.
The test is run on both Linux and Windows. Linux is obviously not an issue, but is there a way, preferably by means of Python, to do this on Windows? Or better yet, is there a library that is cross-compatible, and that would do that for each OS?
You may need install Desktop-Experience package
try the following code:
import platform
if (platform.system() == "Windows"):
os.system('PowerShell Mount-DiskImage C:\path\ConsumerPreview-32bit.iso')
# as mount operates only in powershell
elif (platform.system() == "Linux"):
os.system("mount /dev/dvdrom /mount-point")
for eject DisMount-DiskImage C:\path\English.iso
and for info Get-DiskImage C:\path\English.iso | Get-Volume
You can use mount os.path.join
to join paths.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With