[python-win32] Does pywin32 support SD card operation(IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL)?

Tim Roberts timr at probo.com
Wed Jul 18 21:58:17 CEST 2012


Jane Chen wrote:
> I want my script to tell if the removable disk is an SD card or not,
> so I wrote the following script.
>
> buf_fmt='HHLLLL'  
> buf_size=struct.calcsize(buf_fmt)
>
> drives = (drive for drive in win32api.GetLogicalDriveStrings ().split
> ("\\\000") if drive)
>         for drive in drives:
>             if win32file.GetDriveType (drive)==2:
>                 print "Removable Disk" , drive
>                 if 'A' in drive:
>                     print "floppy"
>                 else:
>                     drive="\\\\.\\"+drive+'.'

Why are you adding a dot?  That's a mistake.  You want  just "\\\\.\\E:"
.  Remove the  +'.' 

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list