[python-win32] GetVolumeInformation throwing exception

Gustavo Tabares gustavotabares at gmail.com
Wed Jan 10 21:57:17 CET 2007


Hrm ok, so this:

win32api.GetVolumeInformation('F:')

only works if your current working directory isn't somewhere on that drive
(as in my example code)? The rest of the time you need to specify an
additional slash or to be safe always include the os separator.

Thanks,
Gus


On 1/10/07, Tim Roberts <timr at probo.com> wrote:
>
> Gustavo Tabares wrote:
> >
> > I'm having a problem with the code below and I'm not sure if there is
> > a bug in win32api.GetVolumeInformation. There is a simple workaround,
> > but I'm curious nonetheless. Any help is appreciated.
> > ...
> > The simple workaround is to add os.sep to the F: string in the last
> > call to GetVolumeInformation; it runs properly. This also still breaks
> > if you chdir back to the local C: drive.
>
> It's not a bug.  When in doubt, always refer to the documentation.  From
> http://msdn2.microsoft.com/en-us/library/aa364993.aspx:
>
> /   lpRootPathName/
>     [in] A pointer to a string that contains the root directory of the
>     volume to be described.
>
>     If this parameter is NULL, the root of the current directory is
>     used. A trailing backslash is required. For example, you specify
>     \\MyServer\MyShare as \\MyServer\MyShare\, or the C drive as "C:\".
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070110/dc1fd3eb/attachment.html 


More information about the Python-win32 mailing list