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

pyinstaller error pytun_pmd3\wintun.py #1047

Open
Vasa211 opened this issue Jun 4, 2024 · 1 comment
Open

pyinstaller error pytun_pmd3\wintun.py #1047

Vasa211 opened this issue Jun 4, 2024 · 1 comment

Comments

@Vasa211
Copy link

Vasa211 commented Jun 4, 2024

I received this error when start exe

Traceback (most recent call last):
  File "main3.py", line 17, in <module>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "pymobiledevice3\remote\tunnel_service.py", line 37, in <module>
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "pytun_pmd3\__init__.py", line 4, in <module>
    from pytun_pmd3.wintun import TunTapDevice
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "pytun_pmd3\wintun.py", line 17, in <module>
    wintun = WinDLL(str(Path(file).parent / f'wintun/bin/{platform.uname().machine}/wintun.dll'), use_last_error=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "PyInstaller\loader\pyimod03_ctypes.py", line 79, in init
pyimod03_ctypes.install.<locals>.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\me\\AppData\\Local\\Temp\\_MEI89162\\pytun_pmd3\\wintun\\bin\\AMD64\\wintun.dll'. Most likely this dynlib/dll was not found when the application was frozen.

I already used command: --add-binary "C:/LociOs/venv/Lib/site-packages/pytun_pmd3/*;pytun_pmd"

What i can do?

@Vasa211 Vasa211 changed the title pyinstaller error pyinstaller error pytun_pmd3\wintun.py Jun 4, 2024
@Confusion-ymc
Copy link

You can give it a try. Two places need to be modified:

  1. Modify line 17 in the venv/Lib/site-packages/pytun_pmd3/wintun.py file, change it to wintun = WinDLL(str(Path(__file__).parent / f'wintun/bin/{platform.uname().machine.lower()}/wintun.dll'), use_last_error=True)
  2. Change C:/LociOs/venv/Lib/site-packages/pytun_pmd3/*;pytun_pmd to C:/LociOs/venv/Lib/site-packages/pytun_pmd3;pytun_pmd3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants