Launch PsychoPy From Terminal

Hi Jenny,
as you might know, PsychoPy comes with its own independent python environment, so first you need to set that environment as your python working environment (see attachment). Secondly, you need to convert the study.psyexp XML script, into a .py module, from within the environment (see the bite of code below). Finally, run it (from within the environment).

from psychopy.app.builder import experiment
import codecs

exp = experiment.Experiment(prefs = None)
exp.loadFromXML(xmlExpFile)
scriptObj = exp.writeScript(xmlExpFile)
if scriptObj is None:
    raise RuntimeError('No script generated for %s' %xmlExpFile)    
codecs.open(pyExpFile, 'w', 'utf-8').write(scriptObj.getvalue())

PsychoPyPython.py (5.1 KB)

Hope this helps.
Cheers,
Luca