[python-win32] Changing a drive letter

Paul Koning pkoning at equallogic.com
Thu Jan 24 20:31:07 CET 2008


>>>>> "Tim" == Tim Roberts <timr at probo.com> writes:

 >> ...And here's the diskpart line:
 >> 
 >> subprocess.call(r'diskpart /s \\%s\someFolder\change_g.txt' %
 >> pdcName)

 Tim> In my own personal opinion, there's absolutely nothing wrong
 Tim> with this.  That's what the tool is there for, after all.  Yes,
 Tim> it would probably be possible for you to dig up the disk manager
 Tim> APIs you need to do the same thing programmatically, but because
 Tim> their use is obscure, they probably aren't going to be exposed
 Tim> in the standard PyWin32 modules, and then you have the added
 Tim> burden of error handling.

I agree.  If you do want to use an API rather than a subprocess, WMI
might serve.  The biggest drawback of WMI is that the documentation is
partly nonexistent and, when it does exist, is of very low quality.

On the other hand, the Python WMI module is quite nice.

   paul



More information about the python-win32 mailing list