I have a program that traverses the directory of a CDROM using os.walk. I do most of my work on Windows, but some on (Ubuntu) Linux, and I'd like this to work in both environments.

On Windows, I do something along the lines of this:

  startpoint="D:/"
  for (root, dirs, files) in os.walk(startpoint):
     (stuff)

What would I use for startpoint in Linux? I've tried "/dev/sr0" and "/dev/sr0/"; neither work. (If I recall correctly, the for-loop just drops through; I'm not at my Linux box right now to confirm.)

A number of other mount points (like /dev/cdrom, I think) are links to /dev/sr0; and don't work either.

It *does* work to start at "/media/VOLUMENAME", where VOLUMENAME is the volume ID of the disc; but my program will not know that. I need to be able to do this without knowing the volume name.

Any ideas?

(I have a nagging suspicion the answer will be that it's not possible to do this in exactly teh same way, and that I'll need to somehow query what volume is mounted on /dev/sr0, and then use the /media/volumename approach)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to