[python-win32] Changing a drive letter
Mike Driscoll
mdriscoll at co.marshall.ia.us
Thu Jan 24 21:41:46 CET 2008
Tim & Paul,
>
> Message: 3
> Date: Thu, 24 Jan 2008 14:31:07 -0500
> From: Paul Koning <pkoning at equallogic.com>
> Subject: Re: [python-win32] Changing a drive letter
> To: timr at probo.com
> Cc: python-win32 at python.org
> Message-ID: <18328.59259.62643.47581 at pkoning-laptop.equallogic.com>
> Content-Type: text/plain; charset=us-ascii
>
> >>>>> "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
>
Well, that's good to know. I would like it to map the USB device to the
next available drive letter and while the docs for diskpart claim that
changing the assign command to the following works:
assign letter
I can't get my test script to work. Oh well...I'll just keep doing what
I'm doing and hope that it doesn't clobber some other device. Thanks for
the affirmations, guys.
Mike
More information about the python-win32
mailing list