"Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out."
Asked Answered
B

3

9

I have installed open source qt creator (free version) and creating very simple desktop application. I am able to create simple window but when I am running I am getting following error:

I have tried to follow this page but could not understand to fix this issue

https://www.qt.io/blog/qt-for-python-6.1

Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
No instance of QPyDesignerCustomWidgetCollection was found.

Python File

# This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys

from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader


    class test(QMainWindow):
        def __init__(self):
            super(test, self).__init__()
            self.load_ui()
    
        def load_ui(self):
            loader = QUiLoader()
            path = os.fspath(Path(__file__).resolve().parent / "form.ui")
            ui_file = QFile(path)
            ui_file.open(QFile.ReadOnly)
            loader.load(ui_file, self)
            ui_file.close()
    
    
    if __name__ == "__main__":
        app = QApplication([])
        widget = test()
        widget.show()
        sys.exit(app.exec_())

adding xml

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>test3</class>
 <widget class="QMainWindow" name="test3">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1332</width>
    <height>702</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>test3</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QCheckBox" name="checkBox">
    <property name="geometry">
     <rect>
      <x>300</x>
      <y>240</y>
      <width>70</width>
      <height>17</height>
     </rect>
    </property>
    <property name="text">
     <string>CheckBox</string>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>1332</width>
     <height>21</height>
    </rect>
   </property>
   <widget class="QMenu" name="menuFile">
    <property name="title">
     <string>File</string>
    </property>
    <addaction name="actionOpen"/>
    <addaction name="actionsave"/>
   </widget>
   <widget class="QMenu" name="menuEdit">
    <property name="title">
     <string>Edit</string>
    </property>
   </widget>
   <widget class="QMenu" name="menuArchive_and_update_indicator">
    <property name="title">
     <string>Archive and update indicator</string>
    </property>
   </widget>
   <addaction name="menuFile"/>
   <addaction name="menuEdit"/>
   <addaction name="menuArchive_and_update_indicator"/>
  </widget>
  <action name="actionOpen">
   <property name="text">
    <string>Open</string>
   </property>
  </action>
  <action name="actionsave">
   <property name="text">
    <string>Save</string>
   </property>
  </action>
 </widget>
 <resources/>
 <connections/>
</ui>
Biographical answered 26/7, 2021 at 11:3 Comment(3)
Could you explain in detail the steps you have followed to create that project. Is it an error or a warning?Cassandracassandre
it is error and not generate outputBiographical
share the .py and others filesCassandracassandre
L
7

You're seeing an informative message from a new and experimental feature in PySide6 called "Custom Widgets". To silence the message you can set the variable "PYSIDE_DESIGNER_PLUGINS" to "." for the current folder.

https://www.qt.io/blog/qt-for-python-6.1 states:

A new experimental plugin for Linux and Windows is shipped that provides > support for writing custom widgets in Python, which can then be selected > from Qt Designer to be used in layouts. Some extra magic is required to > enable this on macOS. We hope to have it ready in 6.1.1!

More about this feature can be found here:

https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html#custom-widgets-in-qt-designer

Litch answered 31/7, 2021 at 19:55 Comment(1)
Setting the environment variable to "." doesn't silence the message for me, it changes it to: qt.pysideplugin: No python files found in '.'. At least it is clear now, what this means, but is there also a way to silence it completely?Smedley
S
1

One way to specifically make the

Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.

message disappear is to set the PYSIDE_DESIGNER_PLUGINS (e.g. os.environ["PYSIDE_DESIGNER_PLUGINS"]=".") to a folder that has a blank register*.py file, for example name a blank file register_dummy.py.

You'll still have the

No instance of QPyDesignerCustomWidgetCollection was found.

though because the register_dummy.py file doesn't call the QPyDesignerCustomWidgetCollection.registerCustomWidget function. To get rid of that you'll just have to make a custom widget, perhaps use the wigglywidget mentioned in the links referenced in the accepted answer, also found at site-packages/PySide6/examples/widgetbinding.

Shah answered 14/7, 2022 at 2:26 Comment(0)
O
-1

How about temporarily disable the warning?

os.environ["QT_LOGGING_RULES"]='*.debug=false;qt.pysideplugin=false'
Onesided answered 3/8, 2023 at 6:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.