-
Notifications
You must be signed in to change notification settings - Fork 125
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 3.3.1 does not work with Pywinauto lib import #342
Comments
I have the same environment, at least for the packages listed above. I first use virtual environment and get the same error. Then I switch back the original environment and get my exe work. Are you using anacondas? May be add ” --hidden-import=comtypes “ in the setup file. An other strange thing is if I switch back to the virtual environment but keep the same pycache folder, my script also works. |
I have the same problem, and I am not using anacondas (I don't know what it is). I tried "--hidden-import=comtypes" and it does not help. Environment: Thank you very much for any help! |
Anacondas contains lots of common packages with Python. I use it to build exe, and I always get it work, thought the size is really LARGE ( usually include pyqt, numpy,mkl , etc). I have no knowledge on tech details, but I guess when a program gets built, python will write some compiled files, including comtype, in pycache (not generated by pyinstaller). Then when you build the second time, pyinstaller will find the codes. |
This looks like File "site-packages\comtypes\client_generate.py", line 169, in _CreateWrapper tries to open a file (namely _944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.py. Please check this place to learn what is done there and why this might fail. Please check if py2exe includes special treatment for pyautowin. |
Just now I fixed this @korniichuk Create folder comtypes/gen/ in the same folder of your test.py, and copy file _944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0.py and UIAutomationClient.py (under Lib/site-packages/comtypes/gen/) into this folder. Then use pyinstaller --hidden-import comtypes.gen._944DE083_8FB8_45CF_BCB7_C477ACB2F897_0_1_0 --hidden-import comtypes.gen.UIAutomationClient test.py Good luck |
@luziling many thanks!! Note: But this is not work for me Different is --onefile and --clean argument place. |
I've got a an additional issue with pywinauto and pyinstaller:
Windows 10 Pro, newest update. |
@luziling no need to create folders or copy files (however I only use the win32 backend)
PyInstaller 3.3.1 |
I've recently had an issue similar to this. After much trial-and-error, I fixed it by adding these to my pyinstaller command line:
|
My application throwed a different error:
It turned out that python -c "import pywinauto"
pyinstaller ... --hidden-import=comtypes.gen.UIAutomationClient ... (python 3.6.8, pywinauto 0.6.6, comtypes 1.1.7, pyinstaller 3.4) |
@luziling any possible drawbacks on this solution that you can foresee? My main concern would be freezing it on windows 10, but then it not working on another version of windows. |
Hi , has anyone got this as the error: |
@GoelPri Open a new issue and fill out the bug report template. That looks unreleated. |
Sure |
Hi all,
need help with PyInstaller and Pywinauto lib.
test.py
file (one liner):Create EXE file based on
test.py
file:PyInstaller output:
Run created
test.exe
file. Output:So, error is:
test.spec
file:Environment:
The text was updated successfully, but these errors were encountered: