Identify drive letter of USB composite device using Python
<p>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.</p>

<p>I don't have an SD card attached to a USB port. To get you started, you could <em>try</em> this on Windows. Install <a href="http://timgolden.me.uk/python/wmi/index.html" rel="nofollow">Golden's WMI</a>. 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.</p>

<pre><code>&gt;&gt;&gt; import wmi
&gt;&gt;&gt; c=wmi.WMI()
... 
&gt;&gt;&gt; for disk in c.Win32_LogicalDisk():
...     print(disk)
</code></pre>

<p>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.</p>

python