Giter Site home page Giter Site logo

Comments (8)

DirkOsswald avatar DirkOsswald commented on May 28, 2024

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.

albertosottile avatar albertosottile commented on May 28, 2024

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.

lambacck avatar lambacck commented on May 28, 2024

@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.

lambacck avatar lambacck commented on May 28, 2024

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.

albertosottile avatar albertosottile commented on May 28, 2024

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.

albertosottile avatar albertosottile commented on May 28, 2024

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.

lambacck avatar lambacck commented on May 28, 2024

@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.

albertosottile avatar albertosottile commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.