PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 19, 2022

[FIXED] How to allow a python script to make changes to program files?

 October 19, 2022     admin, python, uac, windows     No comments   

Issue

When someone downloads my program they get a .py file and another file.

I want the .py file to move the other file to that person's Program Files folder but I get a Permission denied error.

I can't get it to work.

import os 
import glob
import shutil


files = glob.glob("Effects/*")
for f in files:
    shutil.copy(f, "C:/Program Files/Project/Output/")

The Error:

PermissionError: [Errno 13] Permission denied: 'C:/Program Files/Projects/Output\\Output.txt'

I am trying to get admin privileges.

I use python 3.8.5


Solution

I found the solution

When converting the .py file to an .exe file with PyInstaller, use the option

-uac=admin 

Thanks to @mogi



Answered By - Frostbite
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing