def useVersion(requestedVersion):
 imported = _psychopyComponentsImported()
 if imported:
  msg = _translate('Please request a version before importing any PsychoPy modules. (Found: {})')
  raise RuntimeError(msg.format(imported))
 reqdMajorMinorPatch = fullVersion(requestedVersion)
 logging.exp('Requested: useVersion({}) = {}'.format(requestedVersion, reqdMajorMinorPatch))
 if (not reqdMajorMinorPatch):
  msg = _translate('Unknown version `{}`')
  raise ValueError(msg.format(requestedVersion))
 if (psychopy.__version__ != reqdMajorMinorPatch):
  if (not _gitPresent()):
   msg = _translate('Please install git; needed by useVersion()')
   raise RuntimeError(msg)
  _switchToVersion(reqdMajorMinorPatch)
  reload(psychopy)
  reload(logging)
  reload(web)
  if (_versionTuple(reqdMajorMinorPatch) >= (1, 80)):
   reload(tools)
 logging.exp('Version now set to: {}'.format(psychopy.__version__))
 return psychopy.__version__

def useVersion ( requestedVersion ) : imported = _psychopyComponentsImported ( ) if imported : msg = _translate ( 'Please request a version before importing any PsychoPy modules. (Found: {})' ) raise RuntimeError ( msg . format ( imported ) ) reqdMajorMinorPatch = fullVersion ( requestedVersion ) logging . exp ( 'Requested: useVersion({}) = {}' . format ( requestedVersion , reqdMajorMinorPatch ) ) if ( not reqdMajorMinorPatch ) : msg = _translate ( 'Unknown version `{}`' ) raise ValueError ( msg . format ( requestedVersion ) ) if ( psychopy . __version__ != reqdMajorMinorPatch ) : if ( not _gitPresent ( ) ) : msg = _translate ( 'Please install git; needed by useVersion()' ) raise RuntimeError ( msg ) _switchToVersion ( reqdMajorMinorPatch ) reload ( psychopy ) reload ( logging ) reload ( web ) if ( _versionTuple ( reqdMajorMinorPatch ) >= ( 1 , 80 ) ) : reload ( tools ) logging . exp ( 'Version now set to: {}' . format ( psychopy . __version__ ) ) return psychopy . __version__
manage paths and checkout psychopy libraries for requested versions of psychopy .