0
final="cacls " + "E:/" + "\"" + list1[2] + " " + list1[3] + "\""  + "  /p " + str
pro = subprocess.Popen(final,shell=True, stdin=subprocess.PIPE)
pro.communicate(bytes("Y\r\n",'utf-8'))

Trying to set permission to a folder Using Python but while running this command , User input needs to be provided too i.e

it asks ARE YOU SURE(Y/N) and the user needs to enter "Y" or "N"

The above code is not setting the permission.

This was the question i had asked before:

Python code to send command through command line

1 Answer 1

1

As a smart programmer, use PBS

Then, the code is:

from pbs import type as echo# Isn't it echo for Windows? If not, use the correct one

script = Command("/path/to/cacls ")
print script(echo("Y"), ("E:/" + "\"" + list1[2] + " " + list1[3] + "\""  + "  /p " + str).split())
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.