running psychopy prog from a desktop shortcut

683 views
Skip to first unread message

John Allen

unread,
Mar 18, 2013, 12:59:18 PM3/18/13
to psychop...@googlegroups.com
No rocket science here but I thought it might help someone and I've not noticed this discussed elsewhere.

If you want to run your PsychoPy program (either Builder or Coder written) from a desktop shortcut rather than first firing up PsychoPy and opening the script and running it then this may be of interest.

The researched I'd written the program for wanted a really easy way to run the program in the field so I:-

0/ Given a PC with stand-alone PsychoPy already installed
1/ create a DOS batch file containing the following:-

REM Starting PsychoPy program (either builder or coder written)
REM If this fails to run on other PCs edit this
REM batch file and change the path to pickup your local copy of pythonw.exe
REM ...
"C:\Program Files\PsychoPy2\pythonw.exe" myprog_lastrun.py
REM myprog finishing now ...
ping 1.1.1.1 -n 1 -w 5000 >NUL
REM ping command above is to delay exit so that any error messages stay on the screen for long enough to bre read!



*stick this batch file in the same folder as your PscyhoPy script (or adjust calling path accordingly)

2/ Create a desktop shortcut to the BATch file - then just double-click the shortcut to run your program


There are probably other/better ways to do the same thing - I'd be interested to hear other people's solutions to this problem.

NB - If you want a completely stand alone executable then see this other post - http://www.psychopy.org/recipes/appFromScript.html


John


Gary Lupyan

unread,
Mar 18, 2013, 2:11:28 PM3/18/13
to psychop...@googlegroups.com
I just use straight-up Python coding with the psychopy libraries (am not using the psychopy console for anything), so my experiment files are just regular python scripts that can be run with the python interpreter. If you associate python.exe with .py then you can just click on the script and it will execute like any other program. This won't work for debugging because if it quits you won't see the console window, but for running a finished script, it's the simplest way to go.  No need to create batch files.


-Gary

-----------------------------------------------------
Gary Lupyan - lup...@wisc.edu
Assistant Professor of Psychology
University of Wisconsin, Madison
http://sapir.psych.wisc.edu
-----------------------------------------------------





John


--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/r1CIAScqTmIJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

John Allen

unread,
Mar 19, 2013, 5:48:53 AM3/19/13
to psychop...@googlegroups.com
Thanks Gary. From what you say, I'm assuming that you're not using the stand-alone PsychoPy install as unfortunately that method doesn't work for me.

Cheers,
John

Gary Lupyan

unread,
Mar 21, 2013, 2:16:42 PM3/21/13
to psychop...@googlegroups.com
No, but nevertheless, if you associate .py files with the version of python that comes with the standalone PsychoPy you can just click on the script, obviating the need for the batch file.

-Gary

-----------------------------------------------------
Gary Lupyan - lup...@wisc.edu
Assistant Professor of Psychology
University of Wisconsin, Madison
http://sapir.psych.wisc.edu
-----------------------------------------------------


To view this discussion on the web visit https://groups.google.com/d/msg/psychopy-users/-/A1KScpoaVq4J.
Reply all
Reply to author
Forward
0 new messages