| Reference | Downloads | Github

Type Error During Experiment

When running my experiment, which involves listening to sequential, one after the other words in different blocks, I occasionally, but not always get this error message in the output, it stops the experiment and makes an error noise.

File "C:\Program Files (x86)\PyschoPy3\lib\site-packages\psychopy\sound\", line 201, in callback

    dat*=thisSound.volume # Set the volume block by block
TypeError: unsupported operand type(s) for *=: 'NoneType' and 'float'

I found the file it references but am unsure of how to fix this issue, it does not always happen, most of the time the experiment runs through completely fine. Any help is greatly appreciated!

Please show the complete error message. Presumably there is a line in your own script further up the chain that eventually leads to triggering this error.

I apologize, here is the entire output error message.

From cffi callback <function _StreamBase.__init__.<locals>.callback_ptr at 0x000001B4D2B687B8>:
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\", line 740, in callback_ptr
    return _wrap_callback(callback, data, frames, time, status)
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\", line 2516, in _wrap_callback
  File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\", line 201, in callback
    dat *= thisSound.volume  # Set the volume block by block
TypeError: unsupported operand type(s) for *=: 'NoneType' and 'float'

OK, apologies, that wasn’t much more illuminating, to me at least. I’m guessing that you are trying to specify the volume of a sound stimulus. Could you post a screenshot of your sound component that shows how you are doing that (or show any custom code you might be using instead of doing it through the sound component dialog)?

Okay, here are the screenshots. The custom code (that you actually helped me with!) doesn’t seem to have anything to do with setting volume, unless I’m mistaken. There are three blocks where words are playing, the first two use the custom code, and the third uses a conditions file specified through a loop. I’ve seen this error message on all three blocks at some point, the odd thing is that it only happens sometimes and when it does not happen I did not get any of the error messages in the output at all. Is it the sound component(s)?

Found a solution to my problem and figured I’d post it if anyone else has this issue. I went into my PsychoPy preferences and in the hardware tab, deleted the ‘sounddevice’ from the audio library section. So I believe it is using the ‘pyo’ library now, and I have not had the crash since doing that.