Why am i getting WindowsError: [Error 5] Access is denied?
up vote
13
down vote
favorite
Trying to create program that adds folders into program files-recieving this error:
WindowsError: [Error 5] Access is denied 'C:\Program Files\IMP'
Here is my code
import os, sys, random
numb= 1
x=True
while x==True:
newpath = ((r'C:Program FilesIMPfolder_%s') % (numb))
if not os.path.exists(newpath):
os.makedirs(newpath)
numb=numb+1
if numb==11:
x=False
python program-files windowserror
add a comment |
up vote
13
down vote
favorite
Trying to create program that adds folders into program files-recieving this error:
WindowsError: [Error 5] Access is denied 'C:\Program Files\IMP'
Here is my code
import os, sys, random
numb= 1
x=True
while x==True:
newpath = ((r'C:Program FilesIMPfolder_%s') % (numb))
if not os.path.exists(newpath):
os.makedirs(newpath)
numb=numb+1
if numb==11:
x=False
python program-files windowserror
1
do you have write permissions?
– Padraic Cunningham
Feb 15 '15 at 16:12
add a comment |
up vote
13
down vote
favorite
up vote
13
down vote
favorite
Trying to create program that adds folders into program files-recieving this error:
WindowsError: [Error 5] Access is denied 'C:\Program Files\IMP'
Here is my code
import os, sys, random
numb= 1
x=True
while x==True:
newpath = ((r'C:Program FilesIMPfolder_%s') % (numb))
if not os.path.exists(newpath):
os.makedirs(newpath)
numb=numb+1
if numb==11:
x=False
python program-files windowserror
Trying to create program that adds folders into program files-recieving this error:
WindowsError: [Error 5] Access is denied 'C:\Program Files\IMP'
Here is my code
import os, sys, random
numb= 1
x=True
while x==True:
newpath = ((r'C:Program FilesIMPfolder_%s') % (numb))
if not os.path.exists(newpath):
os.makedirs(newpath)
numb=numb+1
if numb==11:
x=False
python program-files windowserror
python program-files windowserror
edited Feb 15 '15 at 16:05
Bhargav Rao♦
29.7k1987110
29.7k1987110
asked Feb 15 '15 at 16:03
ThePrinceofPython
94119
94119
1
do you have write permissions?
– Padraic Cunningham
Feb 15 '15 at 16:12
add a comment |
1
do you have write permissions?
– Padraic Cunningham
Feb 15 '15 at 16:12
1
1
do you have write permissions?
– Padraic Cunningham
Feb 15 '15 at 16:12
do you have write permissions?
– Padraic Cunningham
Feb 15 '15 at 16:12
add a comment |
2 Answers
2
active
oldest
votes
up vote
17
down vote
Because you have to have the "system administrator privileges" to create dirs under C:Program Files.
So try run the script with system administrators privilege.
To start a command prompt as an administrator
- Click Start.
- In the Start Search box, type
cmd, and then press CTRL+SHIFT+ENTER. - Run the python script.
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
4
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
1
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
1
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
add a comment |
up vote
0
down vote
Right click on file (which file/folder's permissions needed to execute the script) go properties, security and enable all permissions, little checkboxes -> ALLOW: "every application package & limited application package & trusted installer"
this is it :)
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
17
down vote
Because you have to have the "system administrator privileges" to create dirs under C:Program Files.
So try run the script with system administrators privilege.
To start a command prompt as an administrator
- Click Start.
- In the Start Search box, type
cmd, and then press CTRL+SHIFT+ENTER. - Run the python script.
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
4
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
1
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
1
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
add a comment |
up vote
17
down vote
Because you have to have the "system administrator privileges" to create dirs under C:Program Files.
So try run the script with system administrators privilege.
To start a command prompt as an administrator
- Click Start.
- In the Start Search box, type
cmd, and then press CTRL+SHIFT+ENTER. - Run the python script.
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
4
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
1
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
1
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
add a comment |
up vote
17
down vote
up vote
17
down vote
Because you have to have the "system administrator privileges" to create dirs under C:Program Files.
So try run the script with system administrators privilege.
To start a command prompt as an administrator
- Click Start.
- In the Start Search box, type
cmd, and then press CTRL+SHIFT+ENTER. - Run the python script.
Because you have to have the "system administrator privileges" to create dirs under C:Program Files.
So try run the script with system administrators privilege.
To start a command prompt as an administrator
- Click Start.
- In the Start Search box, type
cmd, and then press CTRL+SHIFT+ENTER. - Run the python script.
edited Aug 24 '15 at 14:17
answered Feb 15 '15 at 16:11
Aaron
2,02221549
2,02221549
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
4
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
1
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
1
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
add a comment |
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
4
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
1
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
1
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
I am the admin...
– ThePrinceofPython
Feb 15 '15 at 16:15
4
4
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
Use an administrator command prompt and then run the script again.
– Aaron
Feb 15 '15 at 16:19
1
1
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
Aaron is right. You need an admin mode any way. This is a feature of UAC.
– Vasily Ryabov
Feb 16 '15 at 13:25
1
1
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
Is there a way to setup command prompt so that a "user command prompt" always starts up with particular privileges that administrator command prompts have? (Like the privileges that allow a user command prompt to install python modules using pip)
– Minh Tran
Mar 30 '17 at 13:05
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
@Minh Tran I guess you could make a batch script to runas administrator. That'd be pretty easy
– chevydog
Sep 15 '17 at 2:11
add a comment |
up vote
0
down vote
Right click on file (which file/folder's permissions needed to execute the script) go properties, security and enable all permissions, little checkboxes -> ALLOW: "every application package & limited application package & trusted installer"
this is it :)
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
add a comment |
up vote
0
down vote
Right click on file (which file/folder's permissions needed to execute the script) go properties, security and enable all permissions, little checkboxes -> ALLOW: "every application package & limited application package & trusted installer"
this is it :)
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
add a comment |
up vote
0
down vote
up vote
0
down vote
Right click on file (which file/folder's permissions needed to execute the script) go properties, security and enable all permissions, little checkboxes -> ALLOW: "every application package & limited application package & trusted installer"
this is it :)
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Right click on file (which file/folder's permissions needed to execute the script) go properties, security and enable all permissions, little checkboxes -> ALLOW: "every application package & limited application package & trusted installer"
this is it :)
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Nov 10 at 11:58
Zsigamer
1
1
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Zsigamer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
add a comment |
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
This looks like a pretty good answer, but could be improved with explaining what you see as the cause of the problem, and why you think this will solve it.
– Tim Ogilvy
Nov 10 at 12:06
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28528020%2fwhy-am-i-getting-windowserror-error-5-access-is-denied%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
do you have write permissions?
– Padraic Cunningham
Feb 15 '15 at 16:12