How do I write to a CD?

Michael Torrie torriem at chem.byu.edu
Sat Jun 16 18:53:24 EDT 2007


On Sat, 2007-06-16 at 11:50 -0400, k47867 at kearfott.com wrote:
> Hello:
> 
>    I am looking for Python code to open, read, write, close,
> and make bootable the following:
>   CD
>   DVD
>   USB Drive

There will be no cross-platform way to do this.  Certainly no python
libraries.  The closest thing you can get to cross-platform is to popen
various, ported utilities to do the dirty work for you, such as mkisofs.
This is the recommended way, actually.

> 
>    Can I just use open(), read(), write(), and close() for
> these? And how do I make something bootable?
> Is there a portable way to do this that works for both
> windows XP/Vista and Linux?

Nope.  You have to build a file system and copy it to the DVD, CD or USB
drive.  This is absolutely OS-specific.  Of course, from Linux you
should be able to build a fat32 file system and make it boot-able (using
OS tools like mkfs.vfat).  But making a boot-able ext3 partition from
Windows is impossible since the tools needed to make an ext3 file system
do not exist on Windows.

If you are sticking to ISO file systems like UDF or ISO9660, you can use
various programs like mkisofs, dvd+rw-tools, and friends (which have
been ported to Windows).  This is the approach used by *all* Linux
cd-writing applications, like k3b.

> 
> Thanks in advance:
> Michael Yanowitz
> 
> 




More information about the Python-list mailing list