Hi,
First thanks for your feedback.
I don't import other scripts or use the classes, those are black box separated scripts.
Till now I used methods like subprocess.getoutput(cmd) or check_output(..)
as the following:
Hope this explains it.
Please advice,
Thank you for your help,
Limor
First thanks for your feedback.
I don't import other scripts or use the classes, those are black box separated scripts.
Till now I used methods like subprocess.getoutput(cmd) or check_output(..)
as the following:
try: data = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) exitCode = 0 except subprocess.CalledProcessError as ex: data = ex.output data2 = ex.cmd exitCode = ex.returncode writeToAll(logfile, "Command:\n " + str(cmd) + "\nResult:\n Error occurred: " + str(data) + " exit code: " + str(exitCode) + "(0 for SUCCESS). Build will exit.", loggingLevel ) writeInfoToLog( logfile, "---------------------------------------------------------------------------------------------") if exitOnError: exit(exitCode) if data[-1:] == '\n': data = data[:-1] return data, exitCodeBut this won't serve me now in others (I am just a python beginner, not an expert). I will add an example to explain my problem.
#child.py #!/usr/bin/env python import sys # print('Enter user:') user = input() print('Enter password:' ) passwd = input() print('Enter tag:') tag = input()
#Parent.py ... p = subprocess.Popen([PYTHON, "-i", "./child.py"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True) (output, err) = p.communicate() ...Don't know how to continue from here to pass the input parameters user inserted in child.py.
Hope this explains it.
Please advice,
Thank you for your help,
Limor