analyzing removable media

Jay jaysherby at gmail.com
Fri Sep 29 17:04:22 EDT 2006


Dennis is absolutely right.  The reason you won't find a method in the
standard libraries for doing this task specifically is because python
aims to by cross-platform.  If it were to support a method that worked
in the way you describe specifically for Windows, that would
essentially break python's cross-platform compatibility.  It would
create a method that simply wouldn't work on two of the three major
operating systems.  Sorry.

You could write a method or series of methods that does the task you're
describing and have the first method in the chain detect what operating
system it is running on (which I believe is possible through the
standard library) and route the request to the appropriate OS-specific
method.

Just a thought.

Jay
Dennis Lee Bieber wrote:
> On 28 Sep 2006 23:23:23 -0700, "glenn" <glenn at tangelosoftware.net>
> declaimed the following in comp.lang.python:
>
> > Hi  Jay
> > pls excuse top post - Im actually doing this project in linux, but am
> > wanting it to be cross platform. I definitley have to cater for win32
> > also.  I was hoping that burried in sys or os or that there'd be some x
> > platform  module that did all that stuff for me
>
> 	As soon as you ask for "cross platform" and something that is
> device/OS specific... you have conflict.
>
> From the win32 extensions:
>
> win32file.GetDriveType
> int = GetDriveType()
>
> Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk,
> or network drive.
>
> Return Value
> The result is one of the DRIVE_* constants.
>
> 	I suspect Linux would require checking parameters in the fstab file.
> --
> 	Wulfraed	Dennis Lee Bieber		KD6MOG
> 	wlfraed at ix.netcom.com		wulfraed at bestiaria.com
> 		HTTP://wlfraed.home.netcom.com/
> 	(Bestiaria Support Staff:		web-asst at bestiaria.com)
> 		HTTP://www.bestiaria.com/




More information about the Python-list mailing list