auto-py-to-exe
auto-py-to-exe copied to clipboard
Permission Denied When Exporting Files
I am making a very dumb and stupid application, and I decided to turn it into a .exe file. It exports completely fine and runs fine up until one point. For some background, I am making an application that takes an image and turns it into a pet the X or a pet pet. Everything works fine up to the point where it's turned into a .exe and I run it as a .exe. Everything works fine and then I export the petpet file and it says that permission is denied. Any fixes? I am running on Windows 10, and the code works absolutely fine when it's just in python and not an executable. I do not believe it's my code that's the problem more like how PyInstaller and auto-py-to-exe works. I hope I can get this working soon as I have a pretty big project that uses file system stuff too that would be ruined if I couldn't turn it into an exe. Here's my code. The modules that are being used are tkinter, os, pathlib, and I was going to remove sv_ttk. Oh and don't forget the beautiful petpet module. I am using the latest version of python. filedirectory is the file to convert. btw downloaddir is replaced with a file dialog with tkinter but I don't have access to that code right now. There's still no reason why it shouldn't work to begin with though.
from petpetgif import petpet
from tkinter import filedialog, simpledialog, messagebox
from tkinter import *
import os
from pathlib import Path
import sv_ttk
root = Tk()
root.withdraw()
sv_ttk.set_theme("light")
fileDirectory = filedialog.askopenfilename(title="Select image to pet", filetypes=[("PNG Files", "*.png"), ("JPG Files", "*.jpg")])
if (len(fileDirectory) == 0):
messagebox.showerror(title="Error", message="You didn't select a file.")
quit()
outputName = simpledialog.askstring("Output File Name", "What would you like the output file name to be?")
download_dir = str(Path.home() / "Downloads")
if os.name == "posix": #If linux/mac/bsd...
setDirectory = filedialog.askdirectory(title = "Output for petpet")
try:
petpet.make(fileDirectory, setDirectory+"/"+outputName+".gif")
messagebox.showinfo(title="Petpet Success!", message=f"Success! Your pet-pet can be found at {setDirectory}!")
except:
messagebox.showerror(title="Error", message="Error: There was an issue exporting your pet-pet! :( Do you have permissions/root?")
quit()
else: #If Windows...
try:
petpet.make(fileDirectory, download_dir+"/"+outputName+".gif") # file directory is the file to convert
messagebox.showinfo(title="Petpet Success!", message=f"Success! Your pet-pet can be found at {download_dir}!")
except:
messagebox.showerror(title="Error", message="Error: There was an issue exporting your pet-pet! :( Do you have permissions/root?")
quit()
quit()
Can you please provide the whole exception and stack trace
@DINOTICK-Dev , You can try this method
It compiles fine, but I get an error saying permission denied after selecting an image to export into a gif file.
@DINOTICK-Dev , You can try this method
wdym by that?
You should try Pyinstaller manually, going through all individual commands. Cause u said
I do not believe it's my code that's the problem more like how PyInstaller and auto-py-to-exe works.
Oh ok then. I'll see if that works... Which I honestly doubt that it will. I'll keep you informed if it does and possibly a PR if I find why this is happening and I manage to fix it. (I love pull requests lol)
@DINOTICK-Dev May be it's an Admin permission problem
Everything works fine and then I export the petpet file and it says that permission is denied. Any fixes? I am running on Windows 10, and the code works absolutely fine when it's just in python and not an executable.
- Try to run your exe with Administrator permission
Run as administrator
. If does work then try--uac-admin
command with pyinstaller
@Abhijeetbyte I have already tried that. I also tried building with just PyInstaller, with administrator, and set the directory to my downloads.
This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
This issue is stale because it has been open for 60 days with no activity. Remove stale label or comment on this issue or it will be closed in 5 days.
Closing issue due to no activity in more than 60 days.