I would like to use rlcone inside python. If I don't encrypt my rclone config with a password, then I can simply do this:
import subprocess
process = subprocess.Popen(["rclone", "listremotes"], shell=True, stdin=subprocess.PIPE)
output = process.communicate()
print(output)
But I want to protect my Rclone config with a password, so I need a way to send it to rclone. I followed this answer but I get the error Failed to read password: The handle is invalid
:
import subprocess
psw= input("enter psw")
psw_byte= str.encode(psw+'\n')
process = subprocess.Popen(["rclone", "listremotes"], shell=True, stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process.stdin.write(psw_byte)
process.stdin.flush()
output = process.communicate()
print(output)