1920, 'LoadLibraryExW', 'The file cannot be accessed by the system.

503 views
Skip to first unread message

Zapel1

unread,
Jul 20, 2020, 3:01:16 AM7/20/20
to PyInstaller
Every time i want to turn  a .py into an .exe it says:

D:\Programma's\Python>pyinstaller test.py
67 INFO: PyInstaller: 4.0.dev0
67 INFO: Python: 3.8.4
68 INFO: Platform: Windows-10-10.0.18362-SP0
86 INFO: wrote D:\Programma's\Python\test.spec
89 INFO: UPX is not available.
169 INFO: Extending PYTHONPATH with paths
["D:\\Programma's\\Python", "D:\\Programma's\\Python"]
176 INFO: checking Analysis
176 INFO: Building Analysis because Analysis-00.toc is non existent
177 INFO: Initializing module dependency graph...
183 INFO: Caching module graph hooks...
205 INFO: Analyzing base_library.zip ...
2625 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\USER\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2628 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\\lib'
4116 INFO: Caching module dependency graph...
4605 INFO: running Analysis Analysis-00.toc
Traceback (most recent call last):
  File "C:\Users\USER\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\USER\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\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\win32ctypes\core\ctypes\_util.py", line 42, in check_null
    raise make_error(function, function_name)
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 "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "C:\Users\USER\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\USER\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\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 716, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 663, in build
    exec(code, spec_namespace)
  File "D:\Programma's\Python\test.spec", line 6, in <module>
    a = Analysis(['test.py'],
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
    self.__postinit__()
  File "C:\Users\USER\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\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\building\build_main.py", line 389, in assemble
    self.binaries.extend(bindepend.Dependencies([('', python, '')],
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 228, in Dependencies
    for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 407, in getAssemblyFiles
    for assembly in getAssemblies(pth):
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\depend\bindepend.py", line 358, in getAssemblies
    res = GetManifestResources(pth)
  File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\PyInstaller\utils\win32\winmanifest.py", line 1000, in GetManifestResources
    return winresource.GetResources(filename, [RT_MANIFEST], names, languages)
  File "C:\Users\USER\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\USER\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.1264.0_x64__qbz5n2kfra8p0\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\USER\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, 'LoadLibraryExW', 'The file cannot be accessed by the system.')

Can anyone tell me what i can do to make it work? Because i have searched everywhere but couldn't find an answer that worked.

legorooj

unread,
Jul 20, 2020, 6:29:40 AM7/20/20
to pyins...@googlegroups.com
Please try using a virtual environment. This error is because you're using python from the windows store, and that has permissions issues. We can't offer support for the windows store version because to fix the permissions issues you need to mess with the registry heavily and change ownership of vital windows folders, which can break stuff if done improperly.

A virtual environment is the only recommended fix which doesn't involve reinstalling python from another source.

Legorooj

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.

Zapel1

unread,
Jul 20, 2020, 11:36:11 AM7/20/20
to PyInstaller
Thanks, i didn't know i still had the microsoft store version installed on my pc. When i uninstalled that one and installed the correct files from python.org it worked. thank you very much kind sir.

Op maandag 20 juli 2020 om 12:29:40 UTC+2 schreef legorooj:
Reply all
Reply to author
Forward
0 new messages