[GH-ISSUE #166] win32ctypes.pywin32.pywintypes.error: (1920, 'LoadLibraryEx', 'The file cannot be accessed by the system') #154

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

Originally created by @Aarnavv on GitHub (Apr 26, 2021).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/166

Hey, when I am pressing the 'big blue button', I am getting "The file cannot be accessed by the system."

Running auto-py-to-exe v2.8.0
Building directory: C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s
Provided command: pyinstaller --noconfirm --onefile --windowed  "E:/Programming-IMP/PythonCalculator/Calculator.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onefile --windowed E:/Programming-IMP/PythonCalculator/Calculator.py --distpath C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\application --workpath C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\build --specpath C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s

36834 INFO: PyInstaller: 4.3
36836 INFO: Python: 3.8.9
36837 INFO: Platform: Windows-10-10.0.19041-SP0
36842 INFO: wrote C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\Calculator.spec
36848 INFO: UPX is not available.
36852 INFO: Extending PYTHONPATH with paths
['E:\\Programming-IMP\\PythonCalculator',
 'C:\\Users\\Aarnav\\AppData\\Local\\Temp\\tmpm80uya9s']
36871 INFO: checking Analysis
36872 INFO: Building Analysis because Analysis-00.toc is non existent
36873 INFO: Initializing module dependency graph...
36879 INFO: Caching module graph hooks...
36889 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
36908 INFO: Analyzing base_library.zip ...
39262 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\Aarnav\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
39277 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.2544.0_x64__qbz5n2kfra8p0\\lib'
40828 INFO: Caching module dependency graph...
41025 INFO: running Analysis Analysis-00.toc
An error occurred while packaging
Traceback (most recent call last):
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
    yield
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
    return _dll._LoadLibraryEx(fileName, 0, flags)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_dll.py", line 23, in _LoadLibraryEx
    result = check_null(
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__
    self._raise_error(function_name)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error
    raise exception
OSError: [WinError 1920] The file cannot be accessed by the system

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Programming-IMP\Py to EXE Converter\auto-py-to-exe-master\auto_py_to_exe\packaging.py", line 131, in package
    run_pyinstaller()
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 737, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 684, in build
    exec(code, spec_namespace)
  File "C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\Calculator.spec", line 7, in <module>
    a = Analysis(['E:/Programming-IMP/PythonCalculator/Calculator.py'],
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
    self.__postinit__()
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 391, in assemble
    self.binaries.extend(bindepend.Dependencies([('', python, '')],
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 224, in Dependencies
    for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 403, in getAssemblyFiles
    for assembly in getAssemblies(pth):
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 354, in getAssemblies
    res = GetManifestResources(pth)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1016, in GetManifestResources
    return winresource.GetResources(filename, [RT_MANIFEST], names, languages)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winresource.py", line 170, in GetResources
    hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
    return _dll._LoadLibraryEx(fileName, 0, flags)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2544.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
    raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (1920, 'LoadLibraryEx', 'The file cannot be accessed by the system')

Project output will not be moved to output folder
Complete.
Originally created by @Aarnavv on GitHub (Apr 26, 2021). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/166 Hey, when I am pressing the 'big blue button', I am getting "The file cannot be accessed by the system." ``` Running auto-py-to-exe v2.8.0 Building directory: C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s Provided command: pyinstaller --noconfirm --onefile --windowed "E:/Programming-IMP/PythonCalculator/Calculator.py" Recursion Limit is set to 5000 Executing: pyinstaller --noconfirm --onefile --windowed E:/Programming-IMP/PythonCalculator/Calculator.py --distpath C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\application --workpath C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\build --specpath C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s 36834 INFO: PyInstaller: 4.3 36836 INFO: Python: 3.8.9 36837 INFO: Platform: Windows-10-10.0.19041-SP0 36842 INFO: wrote C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\Calculator.spec 36848 INFO: UPX is not available. 36852 INFO: Extending PYTHONPATH with paths ['E:\\Programming-IMP\\PythonCalculator', 'C:\\Users\\Aarnav\\AppData\\Local\\Temp\\tmpm80uya9s'] 36871 INFO: checking Analysis 36872 INFO: Building Analysis because Analysis-00.toc is non existent 36873 INFO: Initializing module dependency graph... 36879 INFO: Caching module graph hooks... 36889 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict. 36908 INFO: Analyzing base_library.zip ... 39262 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\Aarnav\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'. 39277 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.2544.0_x64__qbz5n2kfra8p0\\lib' 40828 INFO: Caching module dependency graph... 41025 INFO: running Analysis Analysis-00.toc An error occurred while packaging Traceback (most recent call last): File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error yield File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_dll.py", line 23, in _LoadLibraryEx result = check_null( File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__ self._raise_error(function_name) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error raise exception OSError: [WinError 1920] The file cannot be accessed by the system During handling of the above exception, another exception occurred: Traceback (most recent call last): File "E:\Programming-IMP\Py to EXE Converter\auto-py-to-exe-master\auto_py_to_exe\packaging.py", line 131, in package run_pyinstaller() File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\__main__.py", line 114, in run run_build(pyi_config, spec_file, **vars(args)) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\__main__.py", line 65, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 737, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 684, in build exec(code, spec_namespace) File "C:\Users\Aarnav\AppData\Local\Temp\tmpm80uya9s\Calculator.spec", line 7, in <module> a = Analysis(['E:/Programming-IMP/PythonCalculator/Calculator.py'], File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 242, in __init__ self.__postinit__() File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__ self.assemble() File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 391, in assemble self.binaries.extend(bindepend.Dependencies([('', python, '')], File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 224, in Dependencies for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects): File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 403, in getAssemblyFiles for assembly in getAssemblies(pth): File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 354, in getAssemblies res = GetManifestResources(pth) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1016, in GetManifestResources return winresource.GetResources(filename, [RT_MANIFEST], names, languages) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winresource.py", line 170, in GetResources hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx return _dll._LoadLibraryEx(fileName, 0, flags) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2544.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "C:\Users\Aarnav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error raise error(exception.winerror, exception.function, exception.strerror) win32ctypes.pywin32.pywintypes.error: (1920, 'LoadLibraryEx', 'The file cannot be accessed by the system') Project output will not be moved to output folder Complete. ```
kerem closed this issue 2026-02-26 12:20:39 +03:00
Author
Owner

@Aarnavv commented on GitHub (Apr 26, 2021):

I am not able to understand which file it cant access. It is all a big mess. :/

<!-- gh-comment-id:826658290 --> @Aarnavv commented on GitHub (Apr 26, 2021): I am not able to understand which file it cant access. It is all a big mess. :/
Author
Owner

@brentvollebregt commented on GitHub (Apr 26, 2021):

Have you read the help post at all?

<!-- gh-comment-id:826775955 --> @brentvollebregt commented on GitHub (Apr 26, 2021): Have you read the help post at all?
Author
Owner

@Aarnavv commented on GitHub (Apr 27, 2021):

Yeah, I had read it and tried almost everything. Turns out I had to reinstall Python, which I didn't want to. But it works now. So thank, ig!

<!-- gh-comment-id:827364075 --> @Aarnavv commented on GitHub (Apr 27, 2021): Yeah, I had read it and tried almost everything. Turns out I had to reinstall Python, which I didn't want to. But it works now. So thank, ig!
Author
Owner

@brentvollebregt commented on GitHub (Apr 27, 2021):

For others that may find this issue, looking up "The file cannot be accessed by the system" or "LoadLibraryEx" in the help post will bring you to the LoadLibraryEx / The file cannot be accessed by the system header.

In this section, I describe that paths like C:\Users\<USER>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\... as shown in the issue above demonstrates that the user is using Python from the Windows Store.

This is not supported and you need to install Python directly from python.org and not use the Python distribution from the Windows Store.

<!-- gh-comment-id:827492005 --> @brentvollebregt commented on GitHub (Apr 27, 2021): For others that may find this issue, looking up "The file cannot be accessed by the system" or "LoadLibraryEx" in the help post will bring you to the [LoadLibraryEx / The file cannot be accessed by the system](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#loadlibraryex-the-file-cannot-be-accessed-by-the-system) header. In this section, I describe that paths like `C:\Users\<USER>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\...` as shown in the issue above demonstrates that the user is using Python from the Windows Store. This is not supported and you need to install Python directly from python.org and not use the Python distribution from the Windows Store.
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#154
No description provided.