Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out
-
I created a small * .ui file in 'pyside6-designer' then run it through QUiLoader (Loading it directly).
I ran the sample code from the site (https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html).After running the main.py file, I get messages to the console:
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out. qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
And after that my code works fine, but I don't know how to disable these messages?
I read this post:
https://stackoverflow.com/questions/68528717/environment-variable-pyside-designer-plugins-is-not-set-bailing-outAnd this one:
https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html#custom-widgets-in-qt-designerAnd this:
https://www.qt.io/blog/qt-for-python-6.1I still can't understand. Please help me
My code 'main.py' file:
import sys from PySide6.QtUiTools import QUiLoader from PySide6.QtWidgets import QApplication from PySide6.QtCore import QFile, QIODevice if __name__ == "__main__": app = QApplication(sys.argv) ui_file_name = "qtable.ui" ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): print(f"Cannot open {ui_file_name}: {ui_file.errorString()}") sys.exit(-1) loader = QUiLoader() window = loader.load(ui_file) ui_file.close() if not window: print(loader.errorString()) sys.exit(-1) window.show() sys.exit(app.exec())
My 'qtable.ui' file:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>658</width> <height>476</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QTableWidget" name="tableWidget"> <property name="geometry"> <rect> <x>30</x> <y>40</y> <width>611</width> <height>192</height> </rect> </property> </widget> <widget class="QPushButton" name="pushButton"> <property name="geometry"> <rect> <x>60</x> <y>260</y> <width>75</width> <height>24</height> </rect> </property> <property name="text"> <string>PushButton</string> </property> </widget> <widget class="QPushButton" name="pushButton_2"> <property name="geometry"> <rect> <x>190</x> <y>260</y> <width>75</width> <height>24</height> </rect> </property> <property name="text"> <string>PushButton</string> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>658</width> <height>22</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> </ui>
I also looked at your example from this link: https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/widgetbinding
I didn't find *.ui file here. Only some xml code in the 'registerwigglywidget.py' file. I don't understand. I need to create *.ui file, then copy the xml content to registerX.py every time (if changed)?
-
I created a small * .ui file in 'pyside6-designer' then run it through QUiLoader (Loading it directly).
I ran the sample code from the site (https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html).After running the main.py file, I get messages to the console:
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out. qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
And after that my code works fine, but I don't know how to disable these messages?
I read this post:
https://stackoverflow.com/questions/68528717/environment-variable-pyside-designer-plugins-is-not-set-bailing-outAnd this one:
https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html#custom-widgets-in-qt-designerAnd this:
https://www.qt.io/blog/qt-for-python-6.1I still can't understand. Please help me
My code 'main.py' file:
import sys from PySide6.QtUiTools import QUiLoader from PySide6.QtWidgets import QApplication from PySide6.QtCore import QFile, QIODevice if __name__ == "__main__": app = QApplication(sys.argv) ui_file_name = "qtable.ui" ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): print(f"Cannot open {ui_file_name}: {ui_file.errorString()}") sys.exit(-1) loader = QUiLoader() window = loader.load(ui_file) ui_file.close() if not window: print(loader.errorString()) sys.exit(-1) window.show() sys.exit(app.exec())
My 'qtable.ui' file:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>658</width> <height>476</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QTableWidget" name="tableWidget"> <property name="geometry"> <rect> <x>30</x> <y>40</y> <width>611</width> <height>192</height> </rect> </property> </widget> <widget class="QPushButton" name="pushButton"> <property name="geometry"> <rect> <x>60</x> <y>260</y> <width>75</width> <height>24</height> </rect> </property> <property name="text"> <string>PushButton</string> </property> </widget> <widget class="QPushButton" name="pushButton_2"> <property name="geometry"> <rect> <x>190</x> <y>260</y> <width>75</width> <height>24</height> </rect> </property> <property name="text"> <string>PushButton</string> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>658</width> <height>22</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> </ui>
I also looked at your example from this link: https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/widgetbinding
I didn't find *.ui file here. Only some xml code in the 'registerwigglywidget.py' file. I don't understand. I need to create *.ui file, then copy the xml content to registerX.py every time (if changed)?
@shepard127 setting variable 'PYSIDE_DESIGNER_PLUGINS' can resolve this message.
For example, you can set "." for the current folder.
os.environ['PYSIDE_DESIGNER_PLUGINS'] = "."
-
We made a change to silence the warning; it is only relevant for Qt Designer ( https://codereview.qt-project.org/c/pyside/pyside-setup/+/494171 ).