AttributeError: 'NoneType' object has no attribute 'getReleases'

Hi there,

I am currently trying to get my experiment to integrate with our Biopac shock hardware via parallel port. I am running a shock calibration script (which connects to the Biopac shock hardware to deliver a shock via parallel port upon receipt of a cue from the computer), and I am getting a slew of error messages that I have no idea how to handle when I try to run the script in runner. The title line is the final error message I receive, though I’m not sure it’s even the error that is breaking my script. Here is the error message:

## Running: C:\Users\dunsmoorlab\Desktop\mrs-m\experiment\calibrate_shock_lastrun.py ##
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Error during device creation ....
_addDeviceView: Error adding class. 
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py", line 708, in createNewMonitoredDevice
    dev_data = self.addDeviceToMonitor(dev_cls_name, dev_conf)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py", line 874, in addDeviceToMonitor
    dev_instance = DeviceClass(dconfig=dev_conf)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 54, in __init__
    self._addRuntimeInfoToDisplayConfig()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 523, in _addRuntimeInfoToDisplayConfig
    self._createPsychopyCalibrationFile()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 711, in _createPsychopyCalibrationFile
    px, py = self.getPixelResolution()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 207, in getPixelResolution
    return self.getConfiguration()['runtime_info']['pixel_resolution']
TypeError: 'NoneType' object is not subscriptable
Error during device creation ....
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py", line 708, in createNewMonitoredDevice
    dev_data = self.addDeviceToMonitor(dev_cls_name, dev_conf)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py", line 874, in addDeviceToMonitor
    dev_instance = DeviceClass(dconfig=dev_conf)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 54, in __init__
    self._addRuntimeInfoToDisplayConfig()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 523, in _addRuntimeInfoToDisplayConfig
    self._createPsychopyCalibrationFile()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 711, in _createPsychopyCalibrationFile
    px, py = self.getPixelResolution()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\devices\display\__init__.py", line 207, in getPixelResolution
    return self.getConfiguration()['runtime_info']['pixel_resolution']
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py", line 642, in _addDevices
    self.createNewMonitoredDevice(dev_cls_name, dev_conf)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\server.py", line 721, in createNewMonitoredDevice
    raise ioHubError('Error during device creation ....')
psychopy.iohub.errors.ioHubError: ioHubError:
Args: ('Error during device creation ....',)

GET_DEV_INTERFACE_ERROR: _getRPCInterface returned: None
GET_DEV_INTERFACE_ERROR: _getRPCInterface returned: None
GET_DEV_INTERFACE_ERROR: _getRPCInterface returned: None
GET_DEV_INTERFACE_ERROR: _getRPCInterface returned: None
20.5962     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).
48.4892     WARNING     Requested an unavailable screen number - using first available.
48.5240     WARNING     User requested fullscreen with size [2194 1234], but screen is actually [1920, 1080]. Using actual size
50.9086     WARNING     t of last frame was 20.39ms (=1/49)
51.0751     WARNING     t of last frame was 20.07ms (=1/49)
51.1090     WARNING     t of last frame was 20.80ms (=1/48)
51.2426     WARNING     t of last frame was 20.95ms (=1/47)
51.3586     WARNING     Multiple dropped frames have occurred - I'll stop bothering you about them!
3.3130     WARNING     Monitor specification not found. Creating a temporary one...
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\client\__init__.py", line 1098, in _addDeviceView
    d = local_class(self, dev_cls_name, dev_config)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\client\keyboard.py", line 205, in __init__
    self._reporting = self.isReportingEvents()
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\iohub\client\__init__.py", line 153, in __getattr__
    raise AttributeError(self, name)
AttributeError: (<psychopy.iohub.client.keyboard.Keyboard object at 0x0000025CF4C62850>, 'isReportingEvents')
Traceback (most recent call last):
  File "C:\Users\dunsmoorlab\Desktop\mrs-m\experiment\calibrate_shock_lastrun.py", line 238, in <module>
    if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\hardware\keyboard.py", line 307, in getKeys
    key_events = Keyboard._iohubKeyboard.getReleases(keys=watchForKeys, clear=clear)
AttributeError: 'NoneType' object has no attribute 'getReleases'
################ Experiment ended with exit code 1 [pid:24020] #################

I know that’s a lot… but I am new to coding and have no idea where to start with all of these errors. It seems like there are maybe packages that aren’t installed on my computer or… something? I have tried figuring out if it was a problem with psychtoolbox with no success. I have also made sure that all of the code in keyboard.py looks right and haven’t been able to catch any bugs there either. Help please!

Can you check which screen number you are using in tthe project, it looks like one is being request that does not exist and this is causing iohub to fail. Thank you

Hi There, as a temporary solution using experiment settings > inputs> and changing keyboard from iohub to psychtoolbox seems to solve this issue!

If a valid Screen id is given in the Builder experiment settings (1 for a single screen setup) , it should run with the iohub backend.

This is great help, thank you!

Oh great, thank you! Yeah, I am still having a hard time figuring out how altering different settings in Builder results in different bugs. I’m adapting this script from another experimental setup so that may be the cause of many of these issues. Thank you!