Is pyton for me?

Kent Johnson kent37 at tds.net
Fri Jun 10 08:49:57 EDT 2005


Andrew Dalke wrote:
> import subprocess
> def gensky(hour):
>   subprocess.check_call(["gensky", "3", "21", str(hour)],
>                        stdout = open("sky%d.rad" % (hour,), "w"))
> 
> 
> The main differences here are:
>  - the original code didn't check the return value of os.system().
> It should do this because, for example, the gensky program might
> not be on the path.  The check_call does that test for me.

Where do you find check_call()? It's not in the docs and I get
 >>> import subprocess
 >>> subprocess.check_call
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'check_call'

with Python 2.4.1.

Kent



More information about the Python-list mailing list