I'm trying to run an
from subprocess import Popen, PIPE
proc = Popen(['scp', "email@example.com:/foo/bar/somefile.txt", "."], stdin = PIPE)
Permission denied, please try again.
The second answer you linked suggests you use Pexpect(which is usually the right way to go about interacting with command line programs that expect input). There is a fork of it which works for python3 which you can use.