2

I have been trying to make a file in C drive but I am getting PermissionError using python 3.6. How can I fix this problem?

import os

os.mkdir('C:\\Program Files\\test_folder')
jpp
  • 159,742
  • 34
  • 281
  • 339
Ghantey
  • 626
  • 2
  • 11
  • 25

1 Answers1

2

To modify C:\Program Files\, you need administrator permissions. So this is not specifically a Python problem.

Run your program from an administrator user, for instance by right-clicking and selecting Run as administrator or using runas in the console. You may also need to pass UAC.

phihag
  • 278,196
  • 72
  • 453
  • 469
  • If this or any other answer solves your problem, please consider [accepting it](https://meta.stackexchange.com/a/5235/141962). Thanks! – phihag Feb 04 '18 at 20:54