def qt_plugins_dir(namespace):
 if (namespace not in ['PyQt4', 'PyQt5', 'PySide']):
  raise Exception('Invalid namespace: {0}'.format(namespace))
 paths = eval_statement('\n        from {0}.QtCore import QCoreApplication;\n        app = QCoreApplication([]);\n        # For Python 2 print would give <PyQt4.QtCore.QStringList\n        # object at 0x....>", so we need to convert each element separately\n        str = getattr(__builtins__, \'unicode\', str);  # for Python 2\n        print([str(p) for p in app.libraryPaths()])\n        '.format(namespace))
 if (not paths):
  raise Exception('Cannot find {0} plugin directories'.format(namespace))
 else:
  valid_paths = []
  for path in paths:
   if os.path.isdir(path):
    valid_paths.append(str(path))
  qt_plugin_paths = valid_paths
 if (not qt_plugin_paths):
  raise Exception('\n            Cannot find existing {0} plugin directories\n            Paths checked: {1}\n            '.format(namespace, ', '.join(paths)))
 return qt_plugin_paths

def qt_plugins_dir ( namespace ) : if ( namespace not in [ 'PyQt4' , 'PyQt5' , 'PySide' ] ) : raise Exception ( 'Invalid namespace: {0}' . format ( namespace ) ) paths = eval_statement ( '\n        from {0}.QtCore import QCoreApplication;\n        app = QCoreApplication([]);\n        # For Python 2 print would give <PyQt4.QtCore.QStringList\n        # object at 0x....>", so we need to convert each element separately\n        str = getattr(__builtins__, \'unicode\', str);  # for Python 2\n        print([str(p) for p in app.libraryPaths()])\n        ' . format ( namespace ) ) if ( not paths ) : raise Exception ( 'Cannot find {0} plugin directories' . format ( namespace ) ) else : valid_paths = [ ] for path in paths : if os . path . isdir ( path ) : valid_paths . append ( str ( path ) ) qt_plugin_paths = valid_paths if ( not qt_plugin_paths ) : raise Exception ( '\n            Cannot find existing {0} plugin directories\n            Paths checked: {1}\n            ' . format ( namespace , ', ' . join ( paths ) ) ) return qt_plugin_paths
return list of paths searched for plugins .