Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I use the pyinstaller 5.x version to generate .exe, but AttributeError:__enter__ #7186

Closed
DeepSpace98 opened this issue Oct 25, 2022 · 1 comment

Comments

@DeepSpace98
Copy link

220525 INFO: Updating manifest in D:\Game\Defect_AI\build\start\start.exe.notanexecutable
220577 INFO: Updating resource type 24 name 1 language 0
220578 INFO: Appending PKG archive to EXE
220601 INFO: Fixing EXE headers
Traceback (most recent call last):
  File "D:\conda\envs\anomalib_env\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\conda\envs\anomalib_env\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\conda\envs\anomalib_env\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\__main__.py", line 179, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\__main__.py", line 60, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\building\build_main.py", line 963, in main
    build(specfile, distpath, workpath, clean_build)
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\building\build_main.py", line 885, in build
    exec(code, spec_namespace)
  File "start.spec", line 31, in <module>
    exe = EXE(
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\building\api.py", line 545, in __init__
    self.__postinit__()
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
    self.assemble()
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\building\api.py", line 790, in assemble
    winutils.set_exe_build_timestamp(build_name, build_timestamp)
  File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\utils\win32\winutils.py", line 157, in set_exe_build_timestamp
    with pefile.PE(exe_path, fast_load=True) as pe:
AttributeError: __enter__

I don't know this error means what? I use pyinstaller 4.8 can normally work.Can you help me?

@DeepSpace98 DeepSpace98 added the triage Please triage and relabel this issue label Oct 25, 2022
@rokm
Copy link
Member

rokm commented Oct 25, 2022

File "D:\conda\envs\anomalib_env\lib\site-packages\PyInstaller\utils\win32\winutils.py", line 157, in set_exe_build_timestamp
    with pefile.PE(exe_path, fast_load=True) as pe:
AttributeError: __enter__

This means the pefile package you have installed is too old, and lacks the context manager support. This was introduced in pefile v2022.5.30 - try upgrading your pefile package. Seeing that this is anaconda environment, you may need to get the latest version from conda-forge instead of base anaconda repository.

@rokm rokm added platform:conda and removed triage Please triage and relabel this issue labels Oct 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants