Skip to content
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

ModuleNotFoundError: No module named 'bindings' error after I compile my code #14

Closed
Yilmaz4 opened this issue Jun 18, 2021 · 2 comments

Comments

@Yilmaz4
Copy link

Yilmaz4 commented Jun 18, 2021

Hello, I'm making a GUI program with your TkinterWeb library. Code normally works without any problems but when I convert it to a *.exe file with pyinstaller and run it, it gives me this error:

Traceback (most recent call last):
  File "MyApp.py", line 40, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "tkinterweb\__init__.py", line 30, in <module>
ModuleNotFoundError: No module named 'bindings'
[4712] Failed to execute script MyApp

But I already have bindings library installed.
I was imported tkinterweb library by from tkinterweb import HtmlFrame in line 40 of my code. Can anyone help me?

@Andereoo
Copy link
Owner

Hello!

It looks like PyInstaller can't find the files necessary to run TkinterWeb. In order to get it to work, you need to explicitly tell PyInstaller to include the TkinterWeb files. Here's what you can do:

  1. Upgrade to the latest version of both TkinterWeb AND PyInstaller. It will not work if you aren't using the latest versions.
  2. Then use the --collect-all tkinterweb flag when bundling your app. For example, if you are using pyinstaller --windowed yourscript.py instead run pyinstaller --windowed --collect-all tkinterweb yourscript.py. This tells PyInstaller to include the TkinterWeb files. On many popular packages, this --collect-all command isn't necessary, because PyInstaller has extra files (called hooks) that tell it what to do if it encounters certain packages. PyInstaller does not come with a hook for TkinterWeb, so you simply have to tell it to include the necessary TkinterWeb files manually.

Let me know if this helps, or if you still encounter issues.

@Yilmaz4
Copy link
Author

Yilmaz4 commented Jun 20, 2021

Thank you! TkinterWeb was outdated, I updated it. PyInstaller was latest version. I also added --collect-all tkinterweb parameter when using pyinstaller and now it works. Have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants