Git Product home page Git Product logo

Comments (6)

AndyW118 avatar AndyW118 commented on July 17, 2024 1

I have fixed it using a hidden import:
pyinstaller -F main.py --hidden-import wakepy._deprecated._windows -n keepawake

Thanks to everyone who helped.

from wakepy.

fohrloop avatar fohrloop commented on July 17, 2024

As a quick comment, I would guess this is because there are dynamical imports in wakepy, and I guess the pyinstaller might not understand to include all the modules to the build.

There probably is some option in pyinstaller which allows you to see which modules (.py files) it did include. Could you check which files were included?

from wakepy.

AndyW118 avatar AndyW118 commented on July 17, 2024

Here's the result of a 'verbose' debug build. Hope it helps.
wakepyVerboseDump.txt

from wakepy.

fohrloop avatar fohrloop commented on July 17, 2024

Thanks for the dump! Basically what it says is the same as in the original question:

ModuleNotFoundError: No module named 'wakepy._deprecated._windows'

What this means is that when you're bundling your python app into an executable with pyinstaller, pyinstaller has not included the file wakepy._deprecated._windows.py. The reason is that wakepy 0.7.1 detects your operating system and imports the correct module at run-time in wakepy/_deprecated/__init__.py using the importlib.import_module.

The pyinstaller documentation talks here about what kinds of modules pyinstaller can automatically detect. It mentions specifically that modules imported dynamically for example with importlib.import_module are not automatically detected by pyinstaller.

I have no experience on pyinstaller so unfortunately I probably cannot help you further with that; I'm guessing this is more about your pyinstaller configuration than about wakepy. I would go first through the pyinstaller docs and make sure it includes all the modules for the used packages. In case of wakepy 0.7.1, you would need to include all the modules from wakepy/_deprecated (or, if you're building only for Windows, the wakepy._deprecated._windows.py).

from wakepy.

ElliotGarbus avatar ElliotGarbus commented on July 17, 2024

from wakepy.

fohrloop avatar fohrloop commented on July 17, 2024

Nice to hear you found a solution!

from wakepy.

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.