1 year ago

#333119

test-img

Reddy

I am facing issue while using subprocess.Popen in Popen

My requirement is, I am calling a shell script from my python script. When the python script is executed. It shows all the shell script content(not only the echo, even the secret keys which are read from param files in shell script) in the output. Here is my code

bashCommand = "sh -x {0} {1} {2} {3} {4} {5} {6} {7} ".format(Shell_script, local_directory,dest_file_path,Overwrite_Flag,file_name,client_id, tenant_id, encrypt_location)
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
output = process.communicate()
logger.info(output.decode())

I just have to write the output of the shell into a log file and if possible I have to print the output of the shell script but not the entire content of the shell script.

Kindly help on this, Thanks

python

subprocess

popen

0 Answers

Your Answer

Accepted video resources