Reading raw data from disc

Grant Edwards grante at visi.com
Mon Dec 13 17:28:08 EST 2004


On 2004-12-13, Ivo Woltring <TheDolphin at ivonet.nl> wrote:

> Is it possible to read e.g. the first 3 sectors of a disc
> without opening a file or somesuch?

Under Linux, no.  

You have to open the device.

> I want to bitwise read a cd-rom or other media without
> consulting a table of contents. Just start at track 0 and go
> on for x bytes. Is it possible with python and if so, please
> help me in the right direction

sectorsize = 2048   # hard drives are usually 512, CDs 2K or 4K
bytes = file('/dev/cdrom','rb').read(3*sectorsize)

I've no idea what to do under Windows...

-- 
Grant Edwards                   grante             Yow!  And furthermore,
                                  at               my bowling average is
                               visi.com            unimpeachable!!!



More information about the Python-list mailing list