I would like to enable safari driver in each session separately.
import os
os.system("sudo safaridriver --enable")
Previous code asks for password. My question is basically how to provide the asked password? I tried something like import subprocess
p = subprocess.Popen(["sudo safaridriver --enable"], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
p.stdin.write(b"password\n") # Assume that the password is indeed "password"
result = p.stdout.read() # The program's output
print(result)
This code doesn't work. Throwing the following error:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
So I'm not sure how to handle it. Additionally it would be great if the password would not be in clear text. But for start clear text is ok.
Thanks for any ideas
ps related text without useful answer here