alejandroautalan/pygubu

CRITICAL BUG: AttributeError: module 'pygubu' has no attribute 'Builder'

lundeen-bryan opened this issue · 2 comments

Preconditions
Windows 11 64bit OS
IDE VSCode
Pygubu version: 0.31

Pygubu is installed in the .venv directory and will run "Code" when exported from the code tab in Pygubu Designer, but will not run in app. Error msg below

Describe the bug
GIVEN user has pygubu
AND user copies the code from the "App" tab in Pygubu Designer and places it in a python file called helloworld.py
AND user has the helloworld.UI XML file in the same directory as the python file
THEN user gets critical error when running the helloworld.py app.

To Reproduce
Steps to reproduce the behavior:

  1. Press the "Run python file" button in VSCode while helloworld.py is in the window
    image

  2. See error
    Error specifically says:

Traceback (most recent call last):
  File "c:\Users\lunde\repos\pygubu\src\helloworld.py", line 31, in <module>
    app = HelloworldApp()
  File "c:\Users\lunde\repos\pygubu\src\helloworld.py", line 14, in __init__
    self.builder = builder = pygubu.Builder()
AttributeError: module 'pygubu' has no attribute 'Builder'

Expected behavior
Python should start a Tkinter app and run it.

Actual behavior
app doesn't run only errors out

Screenshots
See previous steps

Your Environment (please complete the following information):

  • OS: Win 11
  • Python version: 3.10
  • Pygubu version: 0.31
  • Designer version: 0.36

Additional context
This issue was raised in an earlier thread but inadequately described and no follow-up. See #190 (comment)

I discovered what the bug was. It was mine. I named the file pygubu.py and that's what caused it to call back to itself and not find the attribute 'Builder' because that would reside in the source code for pygubu.

If possible, please update the wiki to reflect that this will solve the issue if they get the error: AttributeError: module 'pygubu' has no attribute 'Builder'

Hello @lundeen-bryan thank you for the report. And sorry for the late response.

I discovered what the bug was. It was mine. I named the file pygubu.py and that's what caused it to call back to itself and not find the attribute 'Builder' because that would reside in the source code for pygubu.

I will update the wiki to inform about this sometimes common error.

Regards
Alejandro A.