[python-win32] Re: How to determine CD-ROM or CD-R?

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Dec 9 09:39:00 CET 2004


| Tim Golden wrote:
| > [Qiangning Hong]
| > | How can my program find out the type of disc in my CD-RW 
| > | drive?  I want 
| > | my program behaves differently depend on the type: if it 
| is a normal 
| > | CD-ROM, read data from it; if a recordable CD, burn data onto it.
| > 
| > If you're on Windows, I think WMI can do it. Check out the 
| > Win32_CDROMDrive class and its Capabilities attribute.
| > 
| 
| Thanks for your answer.
| 
| I installed the wmi module and use the following code to generate 
| Win32_CDROMDrive's Capabilities:
| 
|    >>> import wmi
|    >>> c = wmi.WMI()
|    >>> cds = c.CDROMDrive()
|    >>> cds
|    [<wmi._wmi_object instance at 0x00EDC508>]
|    >>> cds[0].Capabilities
|    (3, 7)
| 
| I have only one CD-RW drive with an empty CD-R disc inserted.  It is 
| expected that the capability "4" (write access) should be in 
| cds[0].Capabilities.  However it isn't there.

Looks like I'm wrong then. I only have a CDROM (ie read, not write)
and I also saw (3, 7). When I checked the docs I assumed that a CDRW
would give you the 4.

Might still be worth Googling a bit for WMI CDRW or something
to see if there is some other solution within WMI. Maybe the more
general purpose Win32_LogicalDisk or some other class will
have the information. I don't know for sure, but I'd be surprised
if it wasn't somewhere in WMI.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list