[Tutor] CD ROM Drive

Neven Goršić neven.gorsic at gmail.com
Wed Jul 16 13:31:16 CEST 2008


Hi!

I am using Python 2.5.2 on WinXP Pro and I want to detect all disk drives.
I have C:, D: and E: hard disks and F: DVD ROM.

When I try to use os.access method with writing checking I get True
testing DVD ROM Drive with DVD media inside (which is not writable).
1. Why? DVD disk is not writable!

>>> import os
>>> print os.access('F:\\',os.W_OK)
True

2. When I remove DVD Disk from the drive I get unswer False.
That is OK. But when I run program with that single command
from Windows Explorer I get Windows alert Window:

"No disk! Please insert a disk into drive F:"

That alert stops program and I must respond with: Cancel, Try again or Continue.
The alert remains even with try, except(WindowsError)

Interesting point is that that alert doesn't pop up before I open DVD
for the first time.
After first inserting and ejecting DVD media alert is here!

It seems that information that is DVD no longer avilable is not
updated accordingly.

How can I avoid that?

3. Are there some other way to get list of all disk drives and DVD ROM drives?
I hoped that I can do that with modules that comes with standard
Python instalation.


Thank you very much for your consideration

Neven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: No Disk.jpg
Type: image/jpeg
Size: 9858 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20080716/caa55a4a/attachment.jpg>


More information about the Tutor mailing list