recognize a drive as removable media (e.g. compact flash, sd card or usb drive)

Larry Bates larry.bates at websafe.com
Sat Apr 8 13:47:12 EDT 2006


Mike Joyce wrote:
>     I am trying to write a portable script that will find removable
> media, such as compact flash, sd card, usb, etc. drive and then upload
> files from the media. I want this to be portable so that I can write and
> maintain one program for both Linux and Windows. Each platform uses
> different functions so even if I could find two platform dependent
> functions that would be fine. Basically, I would like to avoid checking
> fixed disks if possible.
>     If anyone know of a good way to do this please let me know. Thanks
> in advance for any help.
> -Mike Joyce

Take a look at the code located at the top of the os.py module.  It
goes through a series of tests to determine which OS it is running
on.  You should be able to use something like that to create branches
in your code to handle Windows/Linux separately.  As far as determining
removable drives in Windows/Linux I'm afraid I can't help on that.

-Larry Bates



More information about the Python-list mailing list