[Baypiggies] how can I change the input parameter in my executable while calling from either os.system or os.popen calls?

David Elsen elsen.david08 at gmail.com
Thu Aug 21 02:53:47 CEST 2008


Hello all,

I have defined a class as following:

class reg:
     def __init__ (self, offset):
                self.offset = offset

     def reg_read(self, offset):
             print 'Read the reg conten specified by offset'
             import os
             read_cmd = './testtool  0x50'
             read_content = os.popen(read_cmd).read()

reg1 = reg (0x50)

reg1.reg_read(0x50)


The above code calls my c executable with offset 0x50 and gives me the
content of 0x50 offset.

I wanted to change the above code as following:

 class reg:
     def __init__ (self, offset):
                self.offset = offset

     def reg_read(self, offset):
             print 'Read the reg conten specified by offset'
             import os
             read_cmd = './testtool  *offset*'
             read_content = os.popen(read_cmd).read()

reg1 = reg (0x50)

reg1.reg_read(0x50)

Basically I wanted to pass the offset as input parameter to my executable
"testtool" and run the testtool for offset.

But looks like it does not allow me to change my offset.

Is there a way to do this in python?

Thanks in advance,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20080820/16a9ae49/attachment.htm>


More information about the Baypiggies mailing list