psychopy.org | Reference | Downloads | Github

'OrderedDict' object has no attribute 'audioStim'


#1

If I use any version of PsychoPy above 1.85.6 I get this error message:

Traceback (most recent call last):
File “/Users/sam/Downloads/AP_Exp_edited/AP_exp_1_edited_down.py”, line 312, in
exec(paramName + ‘= thisTrial.’ + paramName)
File “”, line 1, in
AttributeError: ‘OrderedDict’ object has no attribute ‘audioStim’

…any thoughts/solutions?

Thanks everyone :slight_smile:


#2

Hi @Sam_Leak, it would be great if you could provide a file so we can reproduce this error


#3

Thanks - I uploaded a file for this once before when I brought this up as one of several issues in a slightly meandering previous post. I’ll find the file and reupload it here asap (I’m using my phone currently) :slight_smile:


#4

In terms of moron-level checking of the problem - do I need to have downloaded Python 3 for the more recent versions to work? I’m still using 2.7 at the moment…

Apologies for wasting people’s time if so…


#5

Its no problem. Rather than upload your full experiment, would you be able to make a simple version that recreates the error?

If you are downloading the standalone version, you can download the latest PsychoPy for Python 2 or 3 - see here.


#7

AP_exp_1_troubleshooting.py (6.7 KB)
conditions_piano.xlsx (30.8 KB)

So as code this is now nonsensical but this is reduced just to the bit of it that causes the error. To avoid reading all of the standard setup stuff, just scroll down to where it says ‘START FROM HERE’

Does this offer up any clues to you?


#8

@Sam_Leak, this error relates to line 169 in your code:

exec(paramName + '= thisTrial.' + paramName)

Python is searching the orderedDict object for an attribute called ‘audioStim’, but this attribute does not exist. Python will access your key value pairs using square brackets, and this appears to have been fixed in the recent releases of PsychoPy. Replace line 169 with the following, and this should work:

exec('{} = thisTrial[paramName]'.format(paramName))

#9

Brilliant - that’s fixed it, thanks so much!


#10

I’m running into a similar problem trying to get a task that I was already using to run on a new computer. I edited in the way suggested, which was progress (thanks!), but then still leads to an attribute error.

Traceback (most recent call last):
File “C:\My_Programs\PsychoPy2\Scripts\psychlab\Oddball_threeStimulus_neurospec3.py”, line 392, in
irregularTargets.trialList = reShuffleList(irregularTargets.trialList)
File “C:\My_Programs\PsychoPy2\Scripts\psychlab\Oddball_threeStimulus_neurospec3.py”, line 66, in reShuffleList
fixed = [(pos, item) for (pos,item) in enumerate(trialList) if item.freeze]
AttributeError: ‘OrderedDict’ object has no attribute ‘freeze’

Oddball_threeStimulus_neurospec3.py (29.5 KB)

Any ideas on what I’m missing?
Thanks!


#11

Hi @Lennyr, have you have solved this based on the above? If not, it should work in you replace

fixed = [(pos, item) for (pos,item) in enumerate(trialList) if item.freeze]

with

fixed = [(pos, item) for (pos,item) in enumerate(trialList) if item['freeze']]

That is, if ‘freeze’ is a key in your ordered dict, or a column in your conditions file.


#12

Thanks, that solved it!