def qt_menu_nib_dir(namespace):
 if (namespace not in ['PyQt4', 'PyQt5', 'PySide']):
  raise Exception('Invalid namespace: {0}'.format(namespace))
 menu_dir = None
 path = exec_statement("\n    from {0}.QtCore import QLibraryInfo\n    path = QLibraryInfo.location(QLibraryInfo.LibrariesPath)\n    str = getattr(__builtins__, 'unicode', str)  # for Python 2\n    print(str(path))\n    ".format(namespace))
 anaconda_path = os.path.join(sys.exec_prefix, 'python.app', 'Contents', 'Resources')
 paths = [os.path.join(path, 'Resources'), os.path.join(path, 'QtGui.framework', 'Resources'), anaconda_path]
 for location in paths:
  path = os.path.join(location, 'qt_menu.nib')
  if os.path.exists(path):
   menu_dir = path
   logger.debug('Found qt_menu.nib for {0} at {1}'.format(namespace, path))
   break
 if (not menu_dir):
  raise Exception('\n            Cannot find qt_menu.nib for {0}\n            Path checked: {1}\n            '.format(namespace, ', '.join(paths)))
 return menu_dir

def qt_menu_nib_dir ( namespace ) : if ( namespace not in [ 'PyQt4' , 'PyQt5' , 'PySide' ] ) : raise Exception ( 'Invalid namespace: {0}' . format ( namespace ) ) menu_dir = None path = exec_statement ( "\n    from {0}.QtCore import QLibraryInfo\n    path = QLibraryInfo.location(QLibraryInfo.LibrariesPath)\n    str = getattr(__builtins__, 'unicode', str)  # for Python 2\n    print(str(path))\n    " . format ( namespace ) ) anaconda_path = os . path . join ( sys . exec_prefix , 'python.app' , 'Contents' , 'Resources' ) paths = [ os . path . join ( path , 'Resources' ) , os . path . join ( path , 'QtGui.framework' , 'Resources' ) , anaconda_path ] for location in paths : path = os . path . join ( location , 'qt_menu.nib' ) if os . path . exists ( path ) : menu_dir = path logger . debug ( 'Found qt_menu.nib for {0} at {1}' . format ( namespace , path ) ) break if ( not menu_dir ) : raise Exception ( '\n            Cannot find qt_menu.nib for {0}\n            Path checked: {1}\n            ' . format ( namespace , ', ' . join ( paths ) ) ) return menu_dir
return path to qt resource dir qt_menu .