Issue importing gui

I am having trouble importing the gui in ipython. The command is:

In [1]: from psychopy import gui

When I enter the command above I get the error message below and then ipython quits on me.

The error message is:

2017-01-03 17:31:58.940 Python[43051:1069571] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/3b/pw3plp153j348fktrhrldnym0000gp/T/org.python.python.savedState
Segmentation fault: 11

I am using a Macbook Pro using OSX 10.12.2.
Python version is 2.7
Psychopy version 1.84.2

Any help with this would be greatly appreciated.

Thanks!

ipython is an application with its own event loop and this clashes with the event loop of the widgets being used by PsychoPy (WX or Qt). Basically there’s nothing we can do about it as far as I know and the solution (I think) is not to try and run your experiments in iPython

1 Like

Thanks Jon. So this is unfortunate because the script here, https://github.com/psychopy/psychopy/blob/master/psychopy/demos/coder/experiment%20control/fMRI_launchScan.py
requires you to import the gui. However, I’m not sure where to actually run this script since both ipython and the standard python interpreter crash when I try to run it.

Do you know of another way to run this script?

Are you typing things line-by-line into the interpreter?
PsychoPy is designed to run in scripts. So from the terminal you would do:

python myScript.py

Or you would open your script in PsychoPy app and press the run button. But don’t try to type things in one line at a time.

For a beginner I would strongly recommend you just use the PsychoPy standalone and launch things from there. It includes demos and all sorts of other useful stuff.

So even when I type,
python fMRI_launchScan.py
from the command line (not in python interpreter), I get the exact same segmentation error.

also, i’ll give the standalone version a shot.

i just kind of expected this script to work since it’s just a regular python script.

One more thing. Have you used psychopy with fMRI?

Yes, many people use PsychoPy for fMRI. Everyone using PsychoPy (about 14,000 users per month) can import the gui lib just fine. How did you try to install psychopy? Did you install the dependencies?

I installed most of the dependencies manually using the instructions from here (http://psychopy.org/installation.html). The only one I didn’t install was pypwin32 because I’m using a mac. Also, I feel like the entire script is not the problem. It’s just when I try to import the gui. I also tried this on another computer today. Without running the script at all I just type in “from psychopy import gui” and it crashes.

As I said, install the standalone package, which provides all the dependencies. If something doesn’t work from there then at least we’ll know the libs are all present.

1 Like

Okay. Thanks again Jon!

A post was split to a new topic: Is there a need to “compile” PsychoPy scripts?