Identify drive letter of USB composite device using Python
Question: I have a USB composite device that has an SD card. Using Python, I need a way
to find the drive letter of the SD card when the device is connected. Does
anyone have experience with this? Initially it needs to work in Windows, but
I'll eventually need to port it to Mac and Linux.


Answer: I don't have an SD card attached to a USB port. To get you started, you could
_try_ this on Windows. Install [Golden's
WMI](http://timgolden.me.uk/python/wmi/index.html). I found that the Windows
.zip wouldn't install but the pip version works fine, or at least it does on
Win7. Then you can list logical disks with code like this.

    
    
    >>> import wmi
    >>> c=wmi.WMI()
    ... 
    >>> for disk in c.Win32_LogicalDisk():
    ...     print(disk)
    

This code provided a listing that included mention of a NAS which is why I
have hopes for your SD card. Various refinements are possible.

