[GH-ISSUE #45] cannot parse HMODULE #43

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

Originally created by @ThomasBe on GitHub (Feb 1, 2019).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/45

Setting up evreything seems to work, but if I execute/run the tool via 'auto-py-to-exe' I got:

Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\auto-py-to-exe.exe_main_.py", line 5, in
File "c:\python27\lib\site-packages\auto_py_to_exe_main_.py", line 77, in
from PyInstaller import main as pyi
File "c:\python27\lib\site-packages\pyinstaller-3.4-py2.7.egg\PyInstaller_init_.py", line 16, in
from . import compat
File "c:\python27\lib\site-packages\pyinstaller-3.4-py2.7.egg\PyInstaller\compat.py", line 212, in
from win32ctypes.pywin32 import pywintypes # noqa: F401
File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\pywin32_init_.py", line 11, in
from win32ctypes.pywin32 import win32api
File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\pywin32\win32api.py", line 12, in
from win32ctypes.core import (
File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\core_init_.py", line 36, in load_module
module = importlib.import_module(self.redirect_module)
File "c:\python27\lib\importlib_init_.py", line 37, in import_module
import(name)
File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\core\cffi_dll.py", line 19, in
""")
File "c:\python27\lib\site-packages\cffi\api.py", line 107, in cdef
self._parser.parse(csource, override=override, packed=packed)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 167, in parse
self._internal_parse(csource)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 173, in _internal_parse
ast, macros, csource = self._parse(csource)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 130, in _parse
self.convert_pycparser_error(e, csource)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 159, in convert_pycparser_error
raise api.CDefError(msg)
cffi.api
.
CDefError

cannot parse "HMODULE WINAPI LoadLibraryExW(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags);"
:16:16: before: LoadLibraryExW

I went through all documentation I found online but got no idea what the root cause could be.

Originally created by @ThomasBe on GitHub (Feb 1, 2019). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/45 Setting up evreything seems to work, but if I execute/run the tool via 'auto-py-to-exe' I got: Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\Scripts\auto-py-to-exe.exe\__main__.py", line 5, in <module> File "c:\python27\lib\site-packages\auto_py_to_exe\__main__.py", line 77, in <module> from PyInstaller import __main__ as pyi File "c:\python27\lib\site-packages\pyinstaller-3.4-py2.7.egg\PyInstaller\__init__.py", line 16, in <module> from . import compat File "c:\python27\lib\site-packages\pyinstaller-3.4-py2.7.egg\PyInstaller\compat.py", line 212, in <module> from win32ctypes.pywin32 import pywintypes # noqa: F401 File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\pywin32\__init__.py", line 11, in <module> from win32ctypes.pywin32 import win32api File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\pywin32\win32api.py", line 12, in <module> from win32ctypes.core import ( File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\core\__init__.py", line 36, in load_module module = importlib.import_module(self.redirect_module) File "c:\python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) File "c:\python27\lib\site-packages\pywin32_ctypes-0.2.0-py2.7.egg\win32ctypes\core\cffi\_dll.py", line 19, in <module> """) File "c:\python27\lib\site-packages\cffi\api.py", line 107, in cdef self._parser.parse(csource, override=override, packed=packed) File "c:\python27\lib\site-packages\cffi\cparser.py", line 167, in parse self._internal_parse(csource) File "c:\python27\lib\site-packages\cffi\cparser.py", line 173, in _internal_parse ast, macros, csource = self._parse(csource) File "c:\python27\lib\site-packages\cffi\cparser.py", line 130, in _parse self.convert_pycparser_error(e, csource) File "c:\python27\lib\site-packages\cffi\cparser.py", line 159, in convert_pycparser_error raise api.CDefError(msg) cffi.api . CDefError : cannot parse "HMODULE WINAPI LoadLibraryExW(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags);" :16:16: before: LoadLibraryExW I went through all documentation I found online but got no idea what the root cause could be.
kerem closed this issue 2026-02-26 12:20:17 +03:00
Author
Owner

@brentvollebregt commented on GitHub (Feb 2, 2019):

Looks like something wrong with PyInstaller. Have you tried reinstalling it?

<!-- gh-comment-id:459954317 --> @brentvollebregt commented on GitHub (Feb 2, 2019): Looks like something wrong with PyInstaller. Have you tried reinstalling it?
Author
Owner

@ThomasBe commented on GitHub (Feb 2, 2019):

Looks like something wrong with PyInstaller. Have you tried reinstalling it?

I will try ...

<!-- gh-comment-id:459963367 --> @ThomasBe commented on GitHub (Feb 2, 2019): > Looks like something wrong with PyInstaller. Have you tried reinstalling it? I will try ...
Author
Owner

@ThomasBe commented on GitHub (Feb 4, 2019):

Interesting, I tried with a new installed version of python (x,y) (https://python-xy.github.io/downloads.html) via 'pip install auto-py-to-exe' with the same error.

Then I created a new a virtual environment and manually installed pyinstaller ('setup install') because via pip I always run into trouble. In this clean virtual environment 'pip install auto-py-to-exe' gives me finally a working version.

<!-- gh-comment-id:460137972 --> @ThomasBe commented on GitHub (Feb 4, 2019): Interesting, I tried with a new installed version of python (x,y) (https://python-xy.github.io/downloads.html) via 'pip install auto-py-to-exe' with the same error. Then I created a new a virtual environment and manually installed pyinstaller ('setup install') because via pip I always run into trouble. In this clean virtual environment 'pip install auto-py-to-exe' gives me finally a working version.
Author
Owner

@brentvollebregt commented on GitHub (Feb 4, 2019):

If you call from PyInstaller import __main__ in the environment that wasn't working, do any errors appear?

<!-- gh-comment-id:460142196 --> @brentvollebregt commented on GitHub (Feb 4, 2019): If you call `from PyInstaller import __main__` in the environment that wasn't working, do any errors appear?
Author
Owner

@ThomasBe commented on GitHub (Feb 4, 2019):

I get:

from PyInstaller import main
Traceback (most recent call last):
File "", line 1, in \module|
File @C>Python27libsite-packagespyinstaller-3.4-py2.7.eggPyInstaller__init__.py@, line 16, in \module|
from . import compat
File @C>Python27libsite-packagespyinstaller-3.4-py2.7.eggPyInstallercompat.py@, line 212, in \module|
from win32ctypes.pywin32 import pywintypes noqa> F401
File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypespywin32__init__.py@, line 11, in \module|
from win32ctypes.pywin32 import win32api
File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypespywin32win32api.py@, line 12, in \module|
from win32ctypes.core import *
File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypescore__init__.py@, line 36, in load_module
module ) importlib.import_moduleself.redirect_module(
File @C>Python27libimportlib__init__.py@, line 37, in import_module
importname(
File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypescorecffi_dll.py@, line 19, in \module|
@@@(
File @C>Python27libsite-packagescffiapi.py@, line 107, in cdef
self._parser.parse
csource, override)override, packed)packed(
File @C>Python27libsite-packagescfficparser.py@, line 167, in parse
self._internal_parse
csource(
File @C>Python27libsite-packagescfficparser.py@, line 173, in _internal_parse
ast, macros, csource ) self._parsecsource(
File @C>Python27libsite-packagescfficparser.py@, line 130, in _parse
self.convert_pycparser_error
e, csource(
File @C>Python27libsite-packagescfficparser.py@, line 159, in convert_pycparser_error
raise api.CDefErrormsg(
cffi.api.CDefError> cannot parse @HMODULE WINAPI LoadLibraryExW
LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags(<@
16>16> before> LoadLibraryExW

<!-- gh-comment-id:460176090 --> @ThomasBe commented on GitHub (Feb 4, 2019): I get: >>> from PyInstaller import _main_ Traceback (most recent call last): File "<stdin>", line 1, in \module| File @C>Python27libsite-packagespyinstaller-3.4-py2.7.eggPyInstaller__init__.py@, line 16, in \module| from . import compat File @C>Python27libsite-packagespyinstaller-3.4-py2.7.eggPyInstallercompat.py@, line 212, in \module| from win32ctypes.pywin32 import pywintypes noqa> F401 File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypespywin32__init__.py@, line 11, in \module| from win32ctypes.pywin32 import win32api File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypespywin32win32api.py@, line 12, in \module| from win32ctypes.core import * File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypescore__init__.py@, line 36, in load_module module ) importlib.import_module*self.redirect_module( File @C>Python27libimportlib__init__.py@, line 37, in import_module __import__*name( File @C>Python27libsite-packagespywin32_ctypes-0.2.0-py2.7.eggwin32ctypescorecffi_dll.py@, line 19, in \module| @@@( File @C>Python27libsite-packagescffiapi.py@, line 107, in cdef self._parser.parse*csource, override)override, packed)packed( File @C>Python27libsite-packagescfficparser.py@, line 167, in parse self._internal_parse*csource( File @C>Python27libsite-packagescfficparser.py@, line 173, in _internal_parse ast, macros, csource ) self._parse*csource( File @C>Python27libsite-packagescfficparser.py@, line 130, in _parse self.convert_pycparser_error*e, csource( File @C>Python27libsite-packagescfficparser.py@, line 159, in convert_pycparser_error raise api.CDefError*msg( cffi.api.CDefError> cannot parse @HMODULE WINAPI LoadLibraryExW*LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags(<@ >16>16> before> LoadLibraryExW
Author
Owner

@brentvollebregt commented on GitHub (Feb 4, 2019):

Ok, thank you for this. Since the error occurs outside of auto-py-to-exe then this is not an issue with auto-py-to-exe.

If you're able to setup a guide showing people how to reproduce this error, you could report it to PyInstaller and see if they have any clue what might be causing this.

Also thank you for bringing this up!

<!-- gh-comment-id:460177148 --> @brentvollebregt commented on GitHub (Feb 4, 2019): Ok, thank you for this. Since the error occurs outside of auto-py-to-exe then this is not an issue with auto-py-to-exe. If you're able to setup a guide showing people how to reproduce this error, you could report it to PyInstaller and see if they have any clue what might be causing this. Also thank you for bringing this up!
Author
Owner

@ThomasBe commented on GitHub (Feb 4, 2019):

ok.

<!-- gh-comment-id:460178370 --> @ThomasBe commented on GitHub (Feb 4, 2019): ok.
Author
Owner

@brentvollebregt commented on GitHub (Feb 4, 2019):

Sorry I couldn't help. I have never seen this before and there isn't much help online about the issue.

<!-- gh-comment-id:460178794 --> @brentvollebregt commented on GitHub (Feb 4, 2019): Sorry I couldn't help. I have never seen this before and there isn't much help online about the issue.
Author
Owner

@ThomasBe commented on GitHub (Feb 4, 2019):

No problem.
Meanwhile I found out using the previous version of pyinstaller went fine.
I put not so much attention to the fact that I also has problem installing pyinstaller (3.4.1) via pip. But with 'python -m pip pyinstaller==3.3.1' everything is fine and also 'auto-py-to-exe' runs in my 'normal' environment.

It seems to be that issue:
https://github.com/pypa/pip/issues/6163

<!-- gh-comment-id:460182511 --> @ThomasBe commented on GitHub (Feb 4, 2019): No problem. Meanwhile I found out using the previous version of pyinstaller went fine. I put not so much attention to the fact that I also has problem installing pyinstaller (3.4.1) via pip. But with 'python -m pip pyinstaller==3.3.1' everything is fine and also 'auto-py-to-exe' runs in my 'normal' environment. It seems to be that issue: [https://github.com/pypa/pip/issues/6163](url)
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#43
No description provided.