which

Peter Otten __peter__ at web.de
Fri Feb 5 10:49:22 EST 2010


mk wrote:

> if isinstance(cmd, str):
>      self.cmd = cmd.replace(r'${ADDR}',ip)
> else:
>      self.cmd = cmd
> 
> or
> 
> self.cmd = cmd
> if isinstance(cmd, str):
>      self.cmd = cmd.replace(r'${ADDR}',ip)

Neither.

self.cmd = cmd
self.ip = ip
...
subprocess.call(self.cmd, shell=True, env=dict(ADDR=self.ip))

Please spend a bit more energy on a descriptive subject and an unambiguous 
exposition of your problem (in English rather than code) next time.

Peter




More information about the Python-list mailing list