| Reference | Downloads | Github

Running script from the command line

I’ve got a script set up with a main function and a block like:

if __name__=="__main__":

and I’d ideally like to be able to just run python2 and have it launch the experiment that way. When I do it, however, I get the following error:

This program needs access to the screen. Please run with a Framework build of python, and only when you are logged in on the main display of your Mac.

Trying to figure out a way around this, since copying and pasting all the functions into ipython and then running main() works just fine :slight_smile:

UPDATE: I apparently had installed PsychoPy into my virtualenv but not in the main resource. So, I installed it (pip2 install psychopy --upgrade --user) and now python2 works perfectly! The issue was basically this:

Brief update but this appears to be related: