J. Scull
J. Scull

Reputation: 319

Subprocess emulate user input after command

I have a script where I used a few command-line tools are utilised. However I've hit an issue where I am trying to convert two videos into one video (which I can do) however this is meant to be an idle process and when I run this command with subprocess.call() it prompted me with a 'A file with this name already exists, would you like to overwrite it [y/n]?' and now I am stuck on how to emulate a users input of 'y' + Enter.

It could be a case of running it as admin (somehow) or using pipes or this Stdout stuff I read about but didn't really understand. How would you guys approach this? What do you think the best technique?

Cheers guys, any help is immensely appreciated!

Upvotes: 0

Views: 103

Answers (1)

languitar
languitar

Reputation: 6784

Often, tools you are calling have a -y flag to automatically answer surch questions with yes.

Upvotes: 1

Related Questions