简体   繁体   中英

running a shell command in python get stuck

I am trying to do automatic deployment to AWS beanstalk with a Python script.

When performing the eb init there is a prompt which I can deliver a parameter using the 'yes' command. Even without the yes command, my eb init command get stuck. I use:

os.chdir(folder)

os.system("yes n | eb init --region us-east-1 site")

I understand that I can use also subprocess but not sure exactly on how to use it.

Would love some help Thanks.

may be this can help you

from subprocess import Popen
command='yes n | eb init --region us-east-1 site'
proc=Popen(command)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM