alejandroautalan / pygubu

A simple GUI builder for the python tkinter module
MIT License
2.01k stars 213 forks source link

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

Closed lundeen-bryan closed 6 months ago

lundeen-bryan commented 9 months ago

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):

Additional context This issue was raised in an earlier thread but inadequately described and no follow-up. See https://github.com/alejandroautalan/pygubu/issues/190#issue-615223916

lundeen-bryan commented 9 months ago

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'

alejandroautalan commented 9 months ago

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.