[GH-ISSUE #160] When run auto-py-to-exe with --onefile option I get OSError: [WinError 5] Access is denied, and can not get my .exe file #150

Closed
opened 2026-02-26 12:20:38 +03:00 by kerem · 12 comments
Owner

Originally created by @ScorpJ on GitHub (Mar 19, 2021).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/160

Here is some log from the tool.I am not sure what happened and how can I get the right thing.Bellow is the log I got
Running auto-py-to-exe v2.8.0
Building directory: C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay
Provided command: pyinstaller --noconfirm --onefile --windowed --log-level "CRITICAL" --debug "all" "C:/projects/python/BackCross2SpreadSheetGUI.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onefile --windowed --log-level CRITICAL --debug all C:/projects/python/BackCross2SpreadSheetGUI.py --distpath C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay\application --workpath C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay\build --specpath C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay

An error occurred while packaging
Traceback (most recent call last):
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\core\cffi_resource.py", line 123, in _EndUpdateResource
check_false(
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\core\cffi_util.py", line 81, in call
self._raise_error(function_name)
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\core\cffi_util.py", line 92, in _raise_error
raise exception
OSError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\myapps\anaconda3\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller_main_.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller_main_.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
exec(code, spec_namespace)
File "C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay\BackCross2SpreadSheetGUI.spec", line 20, in
exe = EXE(pyz,
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\api.py", line 450, in init
self.postinit()
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in postinit
self.assemble()
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\api.py", line 602, in assemble
self.manifest.update_resources(tmpnm, [1])
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 949, in update_resources
UpdateManifestResourcesFromXML(dstpath,
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1027, in UpdateManifestResourcesFromXML
winresource.UpdateResources(dstpath, xmlstr, RT_MANIFEST, names or [name],
File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 205, in UpdateResources
win32api.EndUpdateResource(hdst, 0)
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "c:\myapps\anaconda3\lib\contextlib.py", line 131, in exit
self.gen.throw(type, value, traceback)
File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (5, 'EndUpdateResource', 'Access is denied')

Project output will not be moved to output folder
Complete.

Originally created by @ScorpJ on GitHub (Mar 19, 2021). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/160 Here is some log from the tool.I am not sure what happened and how can I get the right thing.Bellow is the log I got Running auto-py-to-exe v2.8.0 Building directory: C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay Provided command: pyinstaller --noconfirm --onefile --windowed --log-level "CRITICAL" --debug "all" "C:/projects/python/BackCross2SpreadSheetGUI.py" Recursion Limit is set to 5000 Executing: pyinstaller --noconfirm --onefile --windowed --log-level CRITICAL --debug all C:/projects/python/BackCross2SpreadSheetGUI.py --distpath C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay\application --workpath C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay\build --specpath C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay An error occurred while packaging Traceback (most recent call last): File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error yield File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource _resource._EndUpdateResource(handle, discard) File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\core\cffi\_resource.py", line 123, in _EndUpdateResource check_false( File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__ self._raise_error(function_name) File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error raise exception OSError: [WinError 5] Access is denied During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:\myapps\anaconda3\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package run_pyinstaller() File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 114, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build exec(code, spec_namespace) File "C:\Users\s1028125\AppData\Local\Temp\tmpxacebnay\BackCross2SpreadSheetGUI.spec", line 20, in <module> exe = EXE(pyz, File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\api.py", line 450, in __init__ self.__postinit__() File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__ self.assemble() File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\building\api.py", line 602, in assemble self.manifest.update_resources(tmpnm, [1]) File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 949, in update_resources UpdateManifestResourcesFromXML(dstpath, File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1027, in UpdateManifestResourcesFromXML winresource.UpdateResources(dstpath, xmlstr, RT_MANIFEST, names or [name], File "c:\myapps\anaconda3\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 205, in UpdateResources win32api.EndUpdateResource(hdst, 0) File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource _resource._EndUpdateResource(handle, discard) File "c:\myapps\anaconda3\lib\contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "c:\myapps\anaconda3\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error raise error(exception.winerror, exception.function, exception.strerror) win32ctypes.pywin32.pywintypes.error: (5, 'EndUpdateResource', 'Access is denied') Project output will not be moved to output folder Complete.
kerem closed this issue 2026-02-26 12:20:38 +03:00
Author
Owner

@ScorpJ commented on GitHub (Mar 19, 2021):

When changed to--onedir get beollow error when run the exe.
Failed to execute script pyiboot01_bootstarp.
Error: 'NoneType object has no attribute 'write'

<!-- gh-comment-id:802575465 --> @ScorpJ commented on GitHub (Mar 19, 2021): When changed to--onedir get beollow error when run the exe. Failed to execute script pyiboot01_bootstarp. Error: 'NoneType object has no attribute 'write'
Author
Owner

@brentvollebregt commented on GitHub (Mar 19, 2021):

OSError: [WinError 5] Access is denied

Have you tried giving the script elevated permissions? It is probably trying to access a file it is not allowed to.

<!-- gh-comment-id:802783571 --> @brentvollebregt commented on GitHub (Mar 19, 2021): > OSError: [WinError 5] Access is denied Have you tried giving the script elevated permissions? It is probably trying to access a file it is not allowed to.
Author
Owner

@ScorpJ commented on GitHub (Mar 21, 2021):

Yes,even run as admin, it is still get the same erroe.

<!-- gh-comment-id:803683419 --> @ScorpJ commented on GitHub (Mar 21, 2021): Yes,even run as admin, it is still get the same erroe.
Author
Owner

@brentvollebregt commented on GitHub (Mar 22, 2021):

Could you create a new Python virtual environment, install auto-py-to-exe and your dependencies and then try to run the tool from this virtual environment please?

<!-- gh-comment-id:803776081 --> @brentvollebregt commented on GitHub (Mar 22, 2021): Could you create a new Python virtual environment, install auto-py-to-exe and your dependencies and then try to run the tool from this virtual environment please?
Author
Owner

@ScorpJ commented on GitHub (Mar 22, 2021):

it's ok on my personal labtop, but has issue on my work labtop.

<!-- gh-comment-id:803781954 --> @ScorpJ commented on GitHub (Mar 22, 2021): it's ok on my personal labtop, but has issue on my work labtop.
Author
Owner

@brentvollebregt commented on GitHub (Mar 22, 2021):

Unless you can identify the difference there is not much I can help with sorry

<!-- gh-comment-id:803783979 --> @brentvollebregt commented on GitHub (Mar 22, 2021): Unless you can identify the difference there is not much I can help with sorry
Author
Owner

@ScorpJ commented on GitHub (Mar 23, 2021):

I close this issue since I can use pyinstaller directly .Thanks for your help, it's realy a good tools.

<!-- gh-comment-id:804511212 --> @ScorpJ commented on GitHub (Mar 23, 2021): I close this issue since I can use pyinstaller directly .Thanks for your help, it's realy a good tools.
Author
Owner

@brentvollebregt commented on GitHub (Mar 23, 2021):

since I can use pyinstaller directly

Sorry, I am not sure what you mean? How did you fix your issue?

<!-- gh-comment-id:804635838 --> @brentvollebregt commented on GitHub (Mar 23, 2021): > since I can use pyinstaller directly Sorry, I am not sure what you mean? How did you fix your issue?
Author
Owner

@ScorpJ commented on GitHub (Mar 23, 2021):

I did not fix the issue just find a workaround to use pyinstaller directlly.

<!-- gh-comment-id:804636805 --> @ScorpJ commented on GitHub (Mar 23, 2021): I did not fix the issue just find a workaround to use pyinstaller directlly.
Author
Owner

@BB6560 commented on GitHub (Jul 18, 2022):

And what would that mysterious workaround of yours be? :)

The only workaround that solved the problem for me is moving the project's folder to another place. For example I moved it directly to D:\ and the error disappeared. I have no idea why, but I hope this helps someone.

<!-- gh-comment-id:1187641813 --> @BB6560 commented on GitHub (Jul 18, 2022): And what would that mysterious workaround of yours be? :) The only workaround that solved the problem for me is moving the project's folder to another place. For example I moved it directly to D:\ and the error disappeared. I have no idea why, but I hope this helps someone.
Author
Owner

@connorhess commented on GitHub (Jul 4, 2023):

this is still an issue, I got it on my work and personal laptop after compiling a few times, will try the work around.

<!-- gh-comment-id:1620207835 --> @connorhess commented on GitHub (Jul 4, 2023): this is still an issue, I got it on my work and personal laptop after compiling a few times, will try the work around.
Author
Owner

@vrawat26 commented on GitHub (Jan 9, 2024):

just create new virtual enviornment and run autopy there

<!-- gh-comment-id:1882467298 --> @vrawat26 commented on GitHub (Jan 9, 2024): just create new virtual enviornment and run autopy there
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#150
No description provided.