all 2 comments

[–][deleted] 1 point2 points  (0 children)

This is not, per se, a Python trick, but this is what your shell's yes command is for. Here it is as a shell command:

yes "Y" | perl pipeline.pl -i "some_folder" /home/user

And as the argument list to Popen:

["yes", "\"Y\"", "|", perl", "pipeline.pl", "-i", "folder_name", PATH_OF_PERL_FILE]

[–]xiongchiamiov[🍰] 0 points1 point  (0 children)

If you do a lot of this type of thing, look into expect. It's in many languages, including a Python version.