Name/ID of removable Media: how?
Ivan Van Laningham
ivanlan at pauahtun.org
Tue Apr 19 11:31:27 EDT 2005
Hi All--
Tim's wmi stuff looked interesting, so I tried it out, and now I have a
question.
-----
#!/usr/bin/python
import wmi
import win32api
c=wmi.WMI()
for i in c.Win32_CDROMDrive():
v=i.VolumeSerialNumber
print "WMI serial",v,long(v,0x10)
vn,sn,ln,flg,fstype=win32api.GetVolumeInformation("d:\\")
print "win32api serial",sn,long(sn)
----
The output from the above script (drive d contains cd) is:
WMI serial D0ADBEE7 3501047527
win32api serial -793919769 -793919769
What's the difference between the two serial numbers? WMI is returning
a long converted to a hex repr string, while win32api is returning an
int (type(sn) is <type 'int'>), & converting to hex bears no resemblance
to what WMI shows. What am I missing?
Metta,
Ivan
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
Author: Teach Yourself Python in 24 Hours
More information about the Python-list
mailing list