parameters: (versions, optionsRequired=False)
docstring: Search for a wxPython installation that matches version.  If one
      is found then sys.path is modified so that version will be
      imported with a 'import wx', otherwise a VersionError exception is
      raised.  This function should only be called once at the beginning
      of the application before wxPython is imported.
  
          :param versions: Specifies the version to look for, it can
              either be a string or a list of strings.  Each string is
              compared to the installed wxPythons and the best match is
              inserted into the sys.path, allowing an 'import wx' to
              find that version.
  
              The version string is composed of the dotted version
              number (at least 2 of the 4 components) optionally
              followed by hyphen ('-') separated options (wx port,
              unicode/ansi, flavour, etc.)  A match is determined by how
              much of the installed version matches what is given in the
              version parameter.  If the version number components don't
              match then the score is zero, otherwise the score is
              increased for every specified optional component that is
              specified and that matches.
  
              Please note, however, that it is possible for a match to
              be selected that doesn't exactly match the versions
              requested.  The only component that is required to be
              matched is the version number.  If you need to require a
              match on the other components as well, then please use the
              optional ``optionsRequired`` parameter described next.
  
          :param optionsRequired: Allows you to specify that the other
               components of the version string (such as the port name
               or character type) are also required to be present for an
               installed version to be considered a match.  Using this
               parameter allows you to change the selection from a soft,
               as close as possible match to a hard, exact match.
docstring_summary: Search for a wxPython installation that matches version.  If one
      is found then sys.path is modified so that version will be
      imported with a 'import wx', otherwise a VersionError exception is
      raised.  This function should only be called once at the beginning
      of the application before wxPython is imported.
docstring_tokens: Search for a wxPython installation that matches version . If one is found then sys . path is modified so that version will be imported with a import wx otherwise a VersionError exception is raised . This function should only be called once at the beginning of the application before wxPython is imported .
function: def select(versions, optionsRequired=False):
      """
      Search for a wxPython installation that matches version.  If one
      is found then sys.path is modified so that version will be
      imported with a 'import wx', otherwise a VersionError exception is
      raised.  This function should only be called once at the beginning
      of the application before wxPython is imported.
  
          :param versions: Specifies the version to look for, it can
              either be a string or a list of strings.  Each string is
              compared to the installed wxPythons and the best match is
              inserted into the sys.path, allowing an 'import wx' to
              find that version.
  
              The version string is composed of the dotted version
              number (at least 2 of the 4 components) optionally
              followed by hyphen ('-') separated options (wx port,
              unicode/ansi, flavour, etc.)  A match is determined by how
              much of the installed version matches what is given in the
              version parameter.  If the version number components don't
              match then the score is zero, otherwise the score is
              increased for every specified optional component that is
              specified and that matches.
  
              Please note, however, that it is possible for a match to
              be selected that doesn't exactly match the versions
              requested.  The only component that is required to be
              matched is the version number.  If you need to require a
              match on the other components as well, then please use the
              optional ``optionsRequired`` parameter described next.
  
          :param optionsRequired: Allows you to specify that the other
               components of the version string (such as the port name
               or character type) are also required to be present for an
               installed version to be considered a match.  Using this
               parameter allows you to change the selection from a soft,
               as close as possible match to a hard, exact match.
          
      """
      if type(versions) == str:
          versions = [versions]
  
      global _selected
      if _selected is not None:
          # A version was previously selected, ensure that it matches
          # this new request
          for ver in versions:
              if _selected.Score(_wxPackageInfo(ver), optionsRequired) > 0:
                  return
          # otherwise, raise an exception
          raise VersionError("A previously selected wx version does not match the new request.")
  
      # If we get here then this is the first time wxversion is used, 
      # ensure that wxPython hasn't been imported yet.
      if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
          raise AlreadyImportedError("wxversion.select() must be called before wxPython is imported")
      
      # Look for a matching version and manipulate the sys.path as
      # needed to allow it to be imported.
      installed = _find_installed(True)
      bestMatch = _get_best_match(installed, versions, optionsRequired)
      
      if bestMatch is None:
          raise VersionError("Requested version of wxPython not found")
  
      sys.path.insert(0, bestMatch.pathname)
      # q.v. Bug #1409256
      path64 = re.sub('/lib/','/lib64/',bestMatch.pathname)
      if os.path.isdir(path64):
          sys.path.insert(0, path64)
      _selected = bestMatch
function_tokens: def select ( versions , optionsRequired = False ) : if type ( versions ) == str : versions = [ versions ] global _selected if _selected is not None : # A version was previously selected, ensure that it matches # this new request for ver in versions : if _selected . Score ( _wxPackageInfo ( ver ) , optionsRequired ) > 0 : return # otherwise, raise an exception raise VersionError ( "A previously selected wx version does not match the new request." ) # If we get here then this is the first time wxversion is used,  # ensure that wxPython hasn't been imported yet. if sys . modules . has_key ( 'wx' ) or sys . modules . has_key ( 'wxPython' ) : raise AlreadyImportedError ( "wxversion.select() must be called before wxPython is imported" ) # Look for a matching version and manipulate the sys.path as # needed to allow it to be imported. installed = _find_installed ( True ) bestMatch = _get_best_match ( installed , versions , optionsRequired ) if bestMatch is None : raise VersionError ( "Requested version of wxPython not found" ) sys . path . insert ( 0 , bestMatch . pathname ) # q.v. Bug #1409256 path64 = re . sub ( '/lib/' , '/lib64/' , bestMatch . pathname ) if os . path . isdir ( path64 ) : sys . path . insert ( 0 , path64 ) _selected = bestMatch