psychopy.org | Reference | Downloads | Github

Type Error using numpy

What are you trying to achieve?:
I’m trying to select stimuli to be used in a training task based on the participants rating of these stimuli. E.g. participant one might see stimuli h3, h6 and h7, whereas participants two might see stimuli h1, h2 and h5.

What did you try to make it work?:
I’ve included a code component in order to select stimuli based on specific ratings

What specifically went wrong when you tried that?:
Initially nothing, it worked perfectly. Then when I went back to it I received the error below. It then later worked again but is now showing up the error.

b=b.astype(numpy.int)

TypeError: int() argument must be a string, a bytes-like object or a number, not ‘NoneType’

My issue is that when it works vs when it doesn’t, I’m not aware that I’m actually changing anything.
I’ve uploaded the builder file in case that helps.Hybrid_100620.psyexp (102.9 KB)

The error indicates that UnhealthyTrials.data['ULiking.response'] might be empty or not created. What do the output files look like?

Taking a look at your file, I had a few thoughts:

  1. First, you don’t need to import numpy; it is already loaded in psychopy as np.
  2. Second, when you initialize b, you might want to make sure you’re initializing it as an array. Otherwise some funky things can happen.
  3. Third, b=b.astype(numpy.int) looks weird to me. Does it still work if you use b=b.astype(int) instead?
  4. Fourth, it looks like you have some code components during the explicit liking sections that are doing the same thing as other builder components (e.g. the slider is in your code and also its own thing?). Are you sure that’s what you want?