psychopy.org | Reference | Downloads | Github

Importing certain iohub modules failed with the latest psychopy installation


#1

As stated in the title, I get importing error even with the iohub demos packaged within:-

Running: D:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\iohub\ioHubDelayTest\run.py

Traceback (most recent call last):
File “D:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\iohub\ioHubDelayTest\run.py”, line 21, in
from psychopy.iohub import Computer, ioHubExperimentRuntime, EventConstants
ImportError: cannot import name ioHubExperimentRuntime

EventConstants (and possibly others which I haven’t quite figured out?) also seem to be missing. Any idea if this is just me, or are people getting this as well?


#2

Hi Aaron, I’m encountering a very similar problem when I try to run a script that includes importing ioHubExperimentRuntime. Were you able to solve this? Thanks so much for any help.


#3

Were you getting “importError: cannot import name ioHubExperimentRuntime” or something like that?

If your method of calling module imports is based on (or something like) this old eyetracking test script - which I am doing at the moment (run.py) from github https://github.com/psychopy/psychopy/blob/master/psychopy/demos/coder/iohub/eyetracking/selectTracker/run.py , this particular import I think, might be a problem:-

from psychopy.iohub import (EventConstants, EyeTrackerConstants, 
getCurrentDateTimeString, ioHubExperimentRuntime)

I was looking into the .py files in psychopy.iohub and realised that EventConstants and EyeTrackerConstants are in the constant.py file, but not getCurrentDateTimeString and ioHubExperimentRuntime. I think something got shifted around during updates?

I had to change it to the following in order to successfully import EventConstants and EyeTrackerConstants:

from psychopy.iohub.constants import (EventConstants, EyeTrackerConstants)

getCurrentDateTimeString and ioHubExperimentRuntime doesn’t seem be in the constant.py script, and I can’t seem to locate it at the moment. Perhaps @jon or @sol knows where we can properly import these two modules from to get them to work?

EDIT: Found the update notes for iohub here: https://github.com/psychopy/psychopy/blob/master/psychopy/iohub/release_notes.rst

Is there a recent iohub demo that we can refer to in the light of the recent changes? Because the run.py file that was uploaded 5 months ago onto github seems to be outdated, and does not reflect many of the changes listed on the patch notes.