Hi Teamm In the below code, we found that the command i.e cmd = "mount /filesystem1" succeeded. But the test failed due to the weaker stderr
def mount_me(): cmd = "mount /filesystem1" proc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = proc.communicate() if err != "": logging.error("Can't run %s got %s!" % (cmd, err)) return False Verification: >> print err 10/25/2015 12:10:28 PM ERROR:Can't run mount /filesystem1 got : mount_err: Reading GUID from 1213: No such file or directory #df -kh Filesystem Size Used Avail Use% Mounted on Filesystem 38G 5.5G 30G 16% /filesystem1 - To handle this case, Iam planning to use return code and modify the above code as below ( Any other suggestions please let me know) def mount_me(): cmd = ("mount /filesystem1") out, err, ret = run(cmd, timeout=60) # run is the wrapper, returns (stdout, stderr, returncode) if ret != 0: # zero means succeeded logging.error("Can't run %s got %s (%d)!" % (cmd, err, ret)) return False - Do I need to add more check to ensure the mount actually succeeds, may be a function? if ret != 0 and check_df_output(): logging.error("Can't run %s got %s (%d)!" % (cmd, err, ret)) Iam using python 2.7 on Linux Regards, Ganesh -- https://mail.python.org/mailman/listinfo/python-list