Comments (8)
Had the same problem. Fixed it, see attached patch.
Donnow how to commit or pull or whatever to this git stuff. Please let me know how to properly give code feedback
py2exe-add-dll-support.zip
from py2exe.
pywin32
is included in the CI/CD test routine and it is working well in the 0.10.0.x tree without this fix. I would encourage you to try again with the latest version (0.10.0.2). For the moment, I am closing this. Please feel free to reopen anytime.
from py2exe.
@albertosottile This still seems to be broken on 0.10.1.0. Locally I'm seeing the issues listed above with pywintypes38.dll and pythoncom38.dll.
from py2exe.
Looks like it's they are getting picked up twice, here with a patch I made to make the above mentioned issue work and let it be a pyd:
Copy c:\python38\lib\site-packages\pywin32_system32\pywintypes38.dll to dist\pywintypes.pyd
Copy C:\WINDOWS\SYSTEM32\pythoncom38.dll to dist\pythoncom.pyd
and again at the end explicitly picking up the ExtensionDLL:
Copy ExtensionDLL c:\python38\lib\site-packages\pywin32_system32\pywintypes38.dll to dist\
Copy ExtensionDLL C:\WINDOWS\SYSTEM32\pythoncom38.dll to dist\
Maybe there is something up with a pip installed pywin32 instead of a installer installed pywin32?
from py2exe.
Interesting... I am not sure I understand what you did here. What I understand is that:
- you patched your copy of
py2exe
to rename (some/all?) the.pyd
file(s) into a.dll
when bundling those - when you try to build a project with
pywin32
, this results in having both the DLL and the PYD in your bundle - the bundled executable does/does not run? This is not clear to me.
Now, about the duplicate issue: not having a duplicate entry (please mind that those are not exactly duplicates but files with different extensions and also, in principle, different purposes in the bundle) was exactly the reason why I was against putting this patch in py2exe
. The build chain should identify the DLL and copy it in the bundle, without any renaming. This is what is happening in the last two lines that you report here and it is also what is happening in the CI test:
Copy ExtensionDLL C:\Python38\Lib\site-packages\pywin32_system32\pywintypes38.dll to dist\
Copy ExtensionDLL C:\Python38\Lib\site-packages\pywin32_system32\pythoncom38.dll to dist\
About the patch you applied, I do not understand why you needed that. It seems that the DLLs are picked up by py2exe
as ExtensionDLL
so, the libraries are imported. Did you experience the RuntimeError
described before without this patch? If so, it would be very interesting to know why you see this error whereas I do not, neither in CI nor in my local tests...
Finally, about the installer version of pywin32
: I honestly do not know and I would strongly encourage you to use PyPI to manage your dependencies. It seems clear that the installer puts some libraries under C:\WINDOWS\SYSTEM32\
whereas the wheel does not. Nevertheless, it seems to me that pythoncom38.dll
is correctly picked up by the DLL copying system in py2exe
so, I would say the different path does not pose an issue on that part. It might be that it affects the module finder somehow, though, and causes the RuntimeError
originally mentioned in this issue. It would be great if you could uninstall py2exe from the installer, reinstall it from PyPI, and try again to reproduce this issue.
from py2exe.
The upcoming version 0.10.2.0 will introduce a new module finder that, in principle, should not trigger this issue anymore. Preliminary wheels for this version can be found on Bintray here: https://bintray.com/py2exe/py2exe/py2exe/0.10.2.0#files
@GadgetSteve @DirkOsswald @lambacck It would be great if you could install this version, repeat your tests with it, and report here if you still experience this issue. Thanks for your time.
from py2exe.
@albertosottile It builds successfully and I get pywintype38.dll but it won't import when I run the resulting service with debug:
>wsgisvc.exe
Traceback (most recent call last):
File "boot_service.py", line 6, in <module>
File "<frozen zipimport>", line 259, in load_module
File "win32serviceutil.pyc", line 10, in <module>
ModuleNotFoundError: No module named 'pywintypes'
from py2exe.
I would say this is a very different issue from the one described here. Please open another one, preferably with a minimal script and setup.py
file that I can use to reproduce the error. Thanks.
from py2exe.
Related Issues (20)
- AssertionError with Python embeddable package HOT 1
- Py_OptimizeFlag not set correctly during Python initialization
- OSError: [WinError 87] The parameter is incorrect. HOT 2
- PYTHONPATH module location HOT 1
- Exe is created by doesn't run (opens then closes)
- Simple pygame example tries to lookup files inside of `library.zip` HOT 1
- Support Python 3.12 HOT 23
- Impossible to specify different version info for each of the binaries with the new freeze API. HOT 3
- pynput import break the file HOT 1
- PYTHONIOENCODING is ignored
- pendulum package doesn't initialize when unpacking from zipfile
- add version for python 3.12 too
- usage missing
- Does py2exe support 'QtWebEngineWidgets' of PySide6?
- How do I get an app using jaydebapi to work as an executable ?
- Failure to import zipextimporter with error "No module named '_memimporter'"
- [freeze][zipfile] Dependent packages and modules are not zipped to library.zip or packed to .exe bin
- ImportError: MemoryLoadLibrary failed loading PyQt5\QtWidgets.pyd: The specified module could not be found. (126)
- no open .whl in windows
- `setuptools.dep_util` is deprecated and will be removed soon. Alternative suggested is `setuptools.modified`. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from py2exe.