Dennis Lee Bieber writes:
> Actually, if 0 is success, and you are testing for a failure, it
> should probably just be
>
> if ret:
> #do error
That obscures the intent; there is nothing about “is ‘ret’ false?” that
tells me what the meaning of that test is.
It happens
On Tue, Oct 27, 2015 at 5:38 PM, Tim Chase
wrote:
> It reduces the redundant code and also brings all of the commands
> together in one place to see the expected steps.
Thanks your suggested code looks nice , I easily knocked off half the
lines of my code :)
--
https://mail.python.org/mailman/l
> According to the format strings, 'ret' is a number. If that's the case,
> it's not a string, so ret != "" will always be true.
>
> Why are you wrapping the command string literals in (...)? That's not
> necessary.
>
> You're doing the same thing with each of the command strings, so why
> not put
On 2015-10-27 17:24, Ganesh Pal wrote:
> from myPopen import run
>
> def configure_network():
> """
> Prepare network for test
> """
> try:
> cmd = ("netadm enable -p ncp DefaultFixed")
> out, err, ret = run(cmd, timeout=60)
> if ret != "":
> log
On 2015-10-27 11:54, Ganesh Pal wrote:
from myPopen import run
def configure_network():
"""
Prepare network for test
"""
try:
cmd = ("netadm enable -p ncp DefaultFixed")
out, err, ret = run(cmd, timeout=60)
if ret != "":
logging.error("
from myPopen import run
def configure_network():
"""
Prepare network for test
"""
try:
cmd = ("netadm enable -p ncp DefaultFixed")
out, err, ret = run(cmd, timeout=60)
if ret != "":
logging.error("Can't run %s got %s (%d)!" % (cmd, err, ret))