Feb-11-2018, 09:49 PM
When I run: python3.5 script.py
Which has:
process = Popen(['command args more args'], stdin=PIPE, stdout=PIPE, shell=True)
The command will prompt me to respond in Y or N with enter continue from a previous session.
This is something that I would respond Y enter
But I am unable to figure out how to respond to it
I have tried
yes = str("Y")
ayes = bytes(yes, 'utf-8')
process.communicate(ayes) #didn't bring even the Y into the console prompt
I've tried
process.communicate('Y\n') #TypeError: memoryview: a bytes-like object is required, not 'str'
and quite a lot of combinations, but I can't seem to get it to work. The machine is running linux with python3.5
I have no idea how to resolve it, even if I type Y manually into the console then it would say: "bash: y: command not found"
Which has:
process = Popen(['command args more args'], stdin=PIPE, stdout=PIPE, shell=True)
The command will prompt me to respond in Y or N with enter continue from a previous session.
This is something that I would respond Y enter
But I am unable to figure out how to respond to it
I have tried
yes = str("Y")
ayes = bytes(yes, 'utf-8')
process.communicate(ayes) #didn't bring even the Y into the console prompt
I've tried
process.communicate('Y\n') #TypeError: memoryview: a bytes-like object is required, not 'str'
and quite a lot of combinations, but I can't seem to get it to work. The machine is running linux with python3.5
I have no idea how to resolve it, even if I type Y manually into the console then it would say: "bash: y: command not found"