alejandroautalan / pygubu

A simple GUI builder for the python tkinter module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run executable file by pyinstaller generated, the erroe showed “ModuleNotFoundError: No module named 'Notebook'”

1893945 opened this issue · comments

Hi, when I Run executable file by pyinstaller generated, the erroe showed “ModuleNotFoundError: No module named 'Notebook'”.
error tip:

[<class 'ModuleNotFoundError'>] No module named 'Notebook'

Traceback (most recent call last):
File "pygubu\builder.py", line 193, in import_class
File "importlib_init
.py", line 127, in import_module
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ttk'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "pygubu\builder.py", line 201, in import_class
File "importlib_init
.py", line 127, in import_module
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ttk'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "tktools.py", line 235, in
File "tktools.py", line 28, in init
File "pygubu\builder.py", line 167, in get_object
File "pygubu\builder.py", line 215, in _realize
File "pygubu\builder.py", line 204, in import_class
File "importlib_init
.py", line 127, in import_module
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'Notebook'

File "tktools.py", line 28 code is:
self.mainwindow = builder.get_object("notebook1", master)

this is the minimum example.
see the attach files:
tk_tools.zip

pyinstaller --add-data "tools2.ui;." -D tktools2.py

pygubu 0.25
pygubu-designer 0.30
pyinstaller 5.4.1
pyinstaller-hooks-contrib 2022.10

note:
I debugged and found that it seemed to be PluginManager.py "for _, name, _ in iter_namespace(pygubu.plugins):" not executed, when run exe file.

so, How should I deal with this problem?

thanks

Hello @1893945 thanks for trying pygubu.

I tried to reproduce the error but I couldn't.

OS: Windows 10
Python: Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
pyinstaller==5.4.1
pyinstaller-hooks-contrib==2022.10
pygubu==0.25
pygubu-designer==0.30

With your example:

pyinstaller --add-data "tools2.ui;." -D tktools2.py

Running the executable, no error is shown.

2022-09-13_22-25

What python version are you using?

Regards
Alejandro A.

Python 3.8.10

your build/tktool2/PYZ-00.toc file have pygubu.plugins.* ?

When I run pyinstaller, system show:
WARNING: discover_hook_directories: Failed to process hook entry point 'hook-dirs = pygubu.__pyinstaller:get_hook_dirs': TypeError: 'type' object is not subscriptable

I run pygubu/__pyinstaller/init.py:
image

Oh, I will try with your python version.

In the meantime, can you test if it works with a spec file similar to this one ?

Regards
Alejandro A.

OK, It is valid to use spec file

Great!