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

PySide2 this application failed to start because it could not find or load the Qt platform plugin "windows" in ""

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P4: Low
    • None
    • 5.6, 5.9
    • PySide
    • None
    • win7,10 amd64
      qt5.6.2 qt5.9.1 amd64
      python3.5 amd64

    Description

      this application failed to start because it could not find or load the Qt platform plugin "windows" in "".
      Reinstalling the application may fix this problem.

      Reason (Lib/site-packages/PySide2/_init_.py):
      _utils.register_qt_conf(prefix=prefix,
      binaries=prefix,
      plugins=prefix+"/plugins",
      imports=prefix+"/imports", #Compile the generated PySide2 package without the "imports" directory
      translations=prefix+"/translations")

      Solution (Lib/site-packages/PySide2/_utils.py):

      def register_qt_conf(prefix, binaries, plugins, imports, translations,
                           force=False):
          """
          Register qt.conf in Qt resource system to override the built-in
          configuration variables, if there is no default qt.conf in
          executable folder and another qt.conf is not already registered in
          Qt resource system.
          """
          try:
              from . import QtCore
          except ImportError:
              return
      
          # Check folder structure
          if not prefix or not os.path.exists(prefix):
              if force:
                  raise RuntimeError("Invalid prefix path specified: %s" % prefix)
              else:
                  return
          if not binaries or not os.path.exists(binaries):
              if force:
                  raise RuntimeError("Invalid binaries path specified: %s" % binaries)
              else:
                  return
          else:
              # Check if required Qt libs exists in binaries folder
              if sys.platform == 'win32':
                  pattern = ["Qt5Core*.dll"]
              else:
                  pattern = ["libQtCore.so.*"]
              if not _dir_contains(binaries, pattern):
                  if force:
                      raise RuntimeError("QtCore lib not found in folder: %s" % \
                          binaries)
                  else:
                      return
          if not plugins or not os.path.exists(plugins):
              if force:
                  raise RuntimeError("Invalid plugins path specified: %s" % plugins)
              else:
                  return
          if not imports or not os.path.exists(imports):
              if force:
                  raise RuntimeError("Invalid imports path specified: %s" % imports)
              #else: #Comment this line
                  #return #Comment this line
      
      
      

      Attachments

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

        Activity

          People

            ctismer Christian Tismer
            liuliuab1 ming liu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes