Reputation: 297
To isolate my problem I run a simple two line example program that runs fine when using IDLE or other Python environment. However, whenb I try to convert the program to an executable using pyinstaller it comes with an error. The error is shown at the end of the printout. Any help to solve this problem is appreciated.
Microsoft Windows [Version 10.0.19043.1110]
(c) Microsoft Corporation. All rights reserved.
C:\>
C:\>C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller example.py
88 INFO: PyInstaller: 4.4
89 INFO: Python: 3.6.5
89 INFO: Platform: Windows-10-10.0.19041-SP0
Traceback (most recent call last):
File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 124, in run
spec_file = run_makespec(**vars(args))
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 58, in run_makespec
spec_file = PyInstaller.building.makespec.main(filenames, **opts)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\makespec.py", line 664, in main
with open(specfnm, 'w', encoding='utf-8') as specfile:
PermissionError: [Errno 13] Permission denied: 'C:\\example.spec'
C:\>
Upvotes: 0
Views: 497
Reputation: 297
I found the problem. By mistake I used the wrong change directory command and because of that I was trying to run the pyinstaller command from the root folder of my C drive, and I don't have permission with a normal command prompt to write files there.
Wrong reference:
C:\>C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller example.py
Correct reference:
C:\Users\Menachem\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller example.py
Upvotes: 1
Reputation: 1322
Permission denied: 'C:\temp.spec'
is your user allowed to write to the root of the C:\
drive?
This begs the question why pyinstaller is trying to write (a temp file?) to C:\
in the first place... is that where your temp.py
file (that you want to build into an .exe
) is located??
Try moving temp.py
to a subfolder of your My Documents
, etc. and run the pyinstaller command from there.
PRO-TIP: if pyinstaller
's path is listed in your PATH
variable, you can call it using only pyinstaller
(without the full/explicit path)
Upvotes: 1