Steven D'Aprano wrote:
if some_condition:
flag = True
else:
flag = False
is better written as:
flag = some_condition
Actually, that's a slight over-simplification.
some_condition may not actually be a bool. If you don't mind flag also
being a non-bool, that's fine, but if you want
Christian Witts wrote:
if child.exitstatus and child.exitstatus == 0:
success = True
else:
success = False
There is never any need to write Python code that looks like that. (Or
in any other language I'm familiar with either.) Anything of the form:
if some_conditio
On 25-Aug-11 01:37, Christian Witts wrote:
Good catch, it should be `if child.exitstatus != None and
child.exitstatus == 0:`
It's better form to say
if child.exitstatus is not None
instead of comparing for equality to None with the != operator.
--
Steve Willoughby / st...@alchemy.com
On 2011/08/25 10:19 AM, Alan Gauld wrote:
On 25/08/11 07:25, Christian Witts wrote:
Once you call child.close() the exit and signal status will be stored in
.exitstatus and .signalstatus, for a normal exit of the program
.exitstatus will store the return code from SCP as per [1] [2] [3] and
.si
On 25/08/11 07:25, Christian Witts wrote:
Once you call child.close() the exit and signal status will be stored in
.exitstatus and .signalstatus, for a normal exit of the program
.exitstatus will store the return code from SCP as per [1] [2] [3] and
.signalstatus will be None. If SCP was termin
Hi Christian,
Thanks for that. I'll give it a shot and see if I can catch the error.
Lekker dag
Johan
From: Christian Witts [mailto:cwi...@compuscan.co.za]
Sent: Thursday, 25 August 2011 4:25 PM
To: Johan Geldenhuys
Cc: tutor@python.org
Subject: Re: [Tutor] Confirmati
On 2011/08/25 07:51 AM, Johan Geldenhuys wrote:
Hi all,
I have the following code that uses pexpect to execute a system command. My
problem is, I don't know how to identify if the command was successfully
executed.
The code works as it is to execute the SCP command, but it executes
regardless i
Hi all,
I have the following code that uses pexpect to execute a system command. My
problem is, I don't know how to identify if the command was successfully
executed.
The code works as it is to execute the SCP command, but it executes
regardless if the SCP session can actually connect to somethin