bqt
bqt copied to clipboard
Hello_World not working
Hi all,
I am getting this error and I was hoping that you could help?
>>> from bqt import hello_world
>>> hello_world.demo()
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/bqt/hello_world.py", line 46, in demo
main_window = QApplication.instance().blender_widget
AttributeError: 'NoneType' object has no attribute 'blender_widget'
Thanks AG
same problem here, @Aiyush-G did you manage to resolve the issue?
Unfortunately no, what platform are you running on?
Windows
This is because the pywin32 dependency is not installed. https://github.com/techartorg/bqt/blob/8437e061b74f1a692ef16b2174144cf5e25120f2/setup.py#L91 Currently, you can make it work by manually installing pywin32.
this happens because QApplication.instance() returns None which can be caused by not having the startup script which registers and instanciates the QApplication.instance the startup script is not included in this repo for some reason. but can be found in the pip package.
you can see that setup.py mentions a script named bqt_startup.py
but no such script is found in this repo 😒
this is the missing file: bqt/dist/bqt_startup.py
import bqt
app = None
def register():
global app
bqt.register()
app = bqt.instantiate_application()
def unregister():
bqt.unregister()
please note I added the global app variable, to store a reference to the application. to prevent it from being garbage collected. this was not there in the original file.
if you place this file in your blender startup, or run setup.py which will attempt to do so for you a QApplication.instance will be created for you on Blender startup. and running QApplication.instance() will no longer return None
above error is caused by blender not running the bqt_startup.py this file has now been added to the repo so a fresh install should solve this. closing this issue