'Permission Error: [Errno 1] Operation Not permitted
I am trying to add some .txt files to my code in pyinstaller, but when I do pyinstaller maze.spec
, I am getting a permission error. I thought a simple sudo would fix it, but i am still getting the error.... Any Idea on what could be wrong?
Here is my error btw
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 112, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 732, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 679, in build
exec(code, spec_namespace)
File "maze.spec", line 20, in <module>
exe = EXE(pyz,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 443, in __init__
self.__postinit__()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
self.assemble()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 520, in assemble
os.remove(self.name)
PermissionError: [Errno 1] Operation not permitted: '/Users/jr194/Bit Club/Test Cases/Maze_Solver_Stack/dist/maze'
Also, I have checked the permissions on the maze folder, and it seems that I have rwr permissions for the user, which I am sure means I am allowed to read and write in it. So i honestly am stumped on this behavior.
Solution 1:[1]
Try to get execution permission first and then execute the script. For that, run chmod +x maze.spec
in the terminal and then try pyinstaller maze.spec
Solution 2:[2]
You could try (from the command line, but I'm sure there's a some error in python
file First Please Check Is There Any Error In Your Python
File):
Well You Can Try:
sudo chown your_username:your_groupname filename
Note: The group is usually just your username. I feel like there's something wrong with those permissions though. Read Write Execute for everyone seems to be off. How was this file created? How did it get to be created by the user nobody?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ajay Dabas |
Solution 2 | Hamza Lachi |