Running Psychopy code in Open Sesame 3.1.2
Hi, I was working on an experiment on eye tracking in Gap Overlap Task. In this, I had to present the random animations for which I wasn't able to figure out in open sesame how to rotate the image as I do not have much experience in inline script python programming so I thought of switching to Psychopy. I have prepared the experiment in Psychopy but wanted the experiment to run in Open Sesame because I also have the questionnaire which is designed in Open Sesame. Now, I read through a similar post by Agata who also asked the same question and I tried the method but I am getting the following error. I am unable able to figure out how to resolve it.
File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/inline_script.py", line 102, in run
self.experiment.python_workspace._exec(self.crun)
File "/Applications/OpenSesame.app/Contents/Resources/lib/python2.7/site-packages/libopensesame/python_workspace.py", line 161, in _exec
exec(bytecode, self._globals)
File "", line 18, in
File "/Users/Arpit/.psychopy2/versions/psychopy/data.py", line 12, in
from pandas import DataFrame, read_csv
ImportError: No module named pandas
Can I download the above module in Open Sesame? If so, how?
Thank you for the help!!
Comments
Hi arpit,
It seems psychopy needs pandas while this package isn't included in the OpenSesame Mac package. You can install it yourself by putting this piece of code in an inline script at the start of your experiment, and then run it once. Once pandas is installed, you can remove these lines (or the whole inline script containing them) again.
If you ever need to install extra packages, see http://osdoc.cogsci.nl/3.1/manual/environment/ for instructions on how to do so.
Daniel.
Thank you, Daniel for a quick reply. It resolved the problem of missing pandas module but again running the script I get another error of:
File "/Users/STEVEMACHINE/.psychopy2/versions/psychopy/gui.py", line 8, in
import wx
ImportError: No module named wx
I tried installing it in a similar manner as suggested by you but I am getting an error.
I was reading through documentation which mentions downloading wxpython for pyschopy backend. Can I install wxpython? Does it have to be in opens sesame?
Right, then you also need wxPython. You should be able to install this with the command
Pretty odd though, as you are not using and GUI elements of psychopy so it should not really be needing wx. In any case, this should help you forward.
I am not sure what you mean when you said using GUI elements of psychopy. Maybe with some explanation I can say if I am using it or not.
I tried your code but am getting the following error
Collecting wxPython
Could not find a version that satisfies the requirement wxPython (from versions: )
No matching distribution found for wxPython
Thanks again
I don't think that
wxPython
can be installed through pip. So installing it into OpenSesame's Python environment will be tricky.wxPython
is the GUI library used by PsychoPy's builder. Apparently, even though you're not actually using the PsychoPy builder, this library is still imported. Could you post your actual script so that we can see where the error comes from?Check out SigmundAI.eu for our OpenSesame AI assistant!
Ok, let's try again, but this time with an attachment ;-)
Check out SigmundAI.eu for our OpenSesame AI assistant!
Stop! Please read my comment above. I'll re-open the discussion in a bit, and then you can upload the script as an attachment, post it to pastebin, or whatever--but not thousands of lines posted as comments!
Check out SigmundAI.eu for our OpenSesame AI assistant!
Sorry for the mess earlier. I am attaching the link of pastebin for the psychopy code.
pastebin.com/ST7kmPdt
Actually, I figured out the need for Wx python as in the code I was importing GUI from Psychopy so that I could enter the participant's info. I have removed that part of the code but I wanted to know if I can implement a similar method in open sesame as it is being used as the file name.
I wish to use the open sesame window to draw the stimuli but instead the psychopy window is being drawn in the inline script. I wish to replace it kindly suggest.
Also, I am using this window to get the frame rate using win.getActualFrameRate() in psychopy. Can you please suggest the replacement in open sesame.
Similarly for win.monitorFramePeriod.
Thanks again.
Your script is intended to be run standalone, and thus creates its own window here:
So you need to remove this line, so that OpenSesame's own
win
object will be used. You also need to remove the lines that quit experiment (again, OpenSesame does that for you):After that, in principle, you should be able to run the experiment.
I'm not sure that this is the way to go, though. Although you can run your script in OpenSesame, doing so will not automagically make your script play nicely with other parts of your experiment. For example, OpenSesame and PsychoPy use different ways of logging data. And you will need to use the psycho backend, which means that forms will be slow. Perhaps it would be easier to just create two separate experiments? One in PsychoPy, as you've already done; and a separate one in OpenSesame, for the questionnaire.
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks Sebastian, I made the required changes in the inline script and now it is running fine. Actually, I have made two separate experiments for each questionnaire and the gap task. But I do not want to use two separate environments so I want to only stick to open sesame. Also in pschopy I need to install the pygaze backend which is already installed in open sesame, so this saves some effort.
I wanted to know how can I use the participant's information entered during the start of experiment as a file name. The information entered at the start of the experiment is stored as which variable and how to use it in inline script.