I am trying to zero an entire usb drive including the boot sector. The
code below works perfect but if I try to open the drive in write
mode(wb) then I get this error message:
IOError: [Errno 2] No such file or directory: u'\\\\.\\PHYSICALDRIVE1'
Code: Select all
import binascii
import wmi
c = wmi.WMI ()
for physical_disk in c.Win32_DiskDrive (InterfaceType='USB'):
for partition in physical_disk.associators
("Win32_DiskDriveToDiskPartition"):
for logical_disk in partition.associators
("Win32_LogicalDiskToPartition"):
print physical_disk.Caption, partition.Caption, logical_disk.Caption
f = open(physical_disk.DeviceID, 'rb')
f.seek(0)
mbr = f.read(512)
f.close()
Any ideas? Thanks.
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32