Thursday 15 March 2012

linux - Capture value from shell script and use it in Python without using subprocess -


I have a dragon script that requires a value from a shell script.

(A.sh):

  #! / Bin / bash return_value () {value = $ (/ / some UNIX commands) "$ value"} return = return_value   

The following is the Python script:

  Reply to Subprocess Import = Subprances Cole ([AK / A.SÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · ??) Print ("Answer is% s% Answer")   

but this does not work Has been doing. Error:

importError: a module called subprocess

I think my verison (Python 2.3.4) is too old. Is there a substitute for subprocess which can be applied in this case ??

Try the module for Py2.3.4, note that this module was removed from py2.6 :

Use:

  import command answer = commands.getoutput ('./.sh')    

No comments:

Post a Comment