process - python 2.4.3 subprocess check_call -


i have apparently old version of python, , when try use

subprocess.check_call(...) 

an error returned saying check_call doesn't exist. there equivalent? way... need understand line invoked when use subprocess.call(...)

you should able use call check_call wrapper subprocess.call(), exists in python 2.4. can write own check_call function:

(warning: not tested don't have python 2.4):

class calledprocesserror(exception):     def __init__(self, returncode, cmd, output=none):         self.returncode = returncode         self.cmd = cmd         self.output = output     def __str__(self):         return "command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)  def check_call(*popenargs, **kwargs):     retcode = subprocess.call(*popenargs, **kwargs)     if retcode:         cmd = kwargs.get("args")         if cmd none:             cmd = popenargs[0]         raise calledprocesserror(retcode, cmd)     return 0 

and instead of subprocess.check_call(...) can call own check_call(...) using same arguments.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -