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

Importing PySide6 adds extraneous handlers to Python logging module

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Not Evaluated 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

      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.

       

       

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes