How to make a cx_freeze executable write on a text file

  cx-freeze, python

I am trying to make a python application and I was able to get the folders I needed into the build folder, but whenever the .exe executes the open(SaveFile, "w") command I get PermissionError: [Errno 13] Permission denied.
This is my setup.py code:

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
# "packages": ["os"] is used as example only
build_exe_options = dict(include_files = ["IMG/", "Saves/"])

# base="Win32GUI" should be used only for Windows GUI app
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name = "PPD Mover",
    description = "An app to help move files for using PPD",
    options = {"build_exe": build_exe_options},
    executables = [Executable("File.py", base=base)]
)

I don’t get any error for reading the file, just for opening it to write on it.
Also, I know this might be a duplicate but the only question I found about this was active last time more than 2 years ago so I thought I could ask myself

Source: Python Questions

LEAVE A COMMENT