Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1644

Importing PySide6 adds extraneous handlers to Python logging module

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 6.1.2
    • PySide
    • None
    • macOS Catalina 10.15.7, Python 3.9.6. Similar behavior reported on Linux (version unknown).
    • macOS

    Description

      When importing PySide6 into a Python script that has logging set up with the default `logging` module, PySide6 adds an extra handler to the root logger.

      This requires the following code in order to get the normal behavior from the logger:

      # Create the logger
      logger = logging.getLogger()
      logger.setLevel(logging.DEBUG)
      
      # Remove PySide6 (or other) handlers
      for h in logger.handlers:
          logger.removeHandler(h)
      

      I have confirmed this issue by running clean scripts with nothing in them but logging code. They work as intended until PySide6 is imported.

      Please see the following posts for details:

      Thanks.

       

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              merkwurdichliebe Merkwurdichliebe GitHub
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes