cdrecord output capture
Carel Fellinger
cfelling at iae.nl
Fri Mar 9 15:30:54 EST 2001
Morelli Enrico <morelli at alpha.cerm.unifi.it> wrote:
> Dear all,
> I am a new user of python.
> I trying to write a small python program under linux to create and
> save ISO files using mkisofs, cdrecord and dialog.
> I'm able to capture mkisofs output using popen2, but I'm not able to do
> the same thing with cdrecord. I had see the source code of eroaster
> (graphic python program that use mkisofs and cdrecord) but this program
> use a difficult way for me, I don't understand all code.
Can you show some code?
doing the obvious seems to work here:
>>> import os
>>> os.popen('cdrecord -scanbus').readlines()
['Cdrecord 1.9 (i586-pc-linux-gnu) Copyright (C) 1995-2000 J\366rg Schilling\012', 'Linux sg driver version: 2.1.39\012', "Using libscg version 'schily-0.1'\012", 'scsibus0:\012', "\0110,0,0\011 0) 'PLEXTOR ' 'CD-ROM PX-40TS ' '1.11' Removable CD-ROM\012", '\0110,1,0\011 1) *\012', '\0110,2,0\011 2) *\012', '\0110,3,0\011 3) *\012', '\0110,4,0\011 4) *\012', '\0110,5,0\011 5) *\012', '\0110,6,0\011 6) *\012', '\0110,7,0\011 7) *\012', 'scsibus1:\012', "\0111,0,0\011100) 'PLEXTOR ' 'CD-R PX-W8432T' '1.07' Removable CD-ROM\012", '\0111,1,0\011101) *\012', '\0111,2,0\011102) *\012', '\0111,3,0\011103) *\012', '\0111,4,0\011104) *\012', '\0111,5,0\011105) *\012', '\0111,6,0\011106) *\012', '\0111,7,0\011107) *\012']
>>> os.popen2('cdrecord -scanbus')[1].readlines()
same output
--
groetjes, carel
More information about the Python-list
mailing list