What are you trying to achieve?:
Hi. I’m trying to run a cued object naming task, where I present a cue (in the form of a red or a green square) after the fixation cross to indicate the language that the participant has to name the image (which follows the cue) in.
I have the stimulus images in an excel sheet, which is attached in the conditions file of the loop as shown in the flow below.
There is a code component in the begin experiment tab of the cue_colour routine which is the follows:
cue="."
if $order="red.png":
cue="red.png"
else:
cue="green.png"
I need the cue to appear in a random order, along with the randomisation of stimulus image that appears after the cue. I also need the objects to appear only once.
This is the problem: The image files (stimulus) are now appearing twice in a row
I would really like some help with resolving this issue, since I’m approaching a deadline soon.
I installed the latest version of psychopy and made the experiment again.
I used the same code components as my earlier experiments but it is now showing a python syntax error.
I’m attaching images below for reference.
Could you please point out where the problem lies, since I’m not that familiar with coding?
Since you have a component called cue_2, then I suspect cue exists as a component elsewhere. This routine looks like a copy of a previous one. I would recommend that you change cue to something else here.
In your code you should only have one equals sign when setting the cue image as red or green. The double-equals only occurs when testing for equality (in the if statement).
Hi, I tried this. But the error still shows up in the code that I used previously, even if the code does not exist anywhere!
This is the code that I replaced it with:
myData = data.TrialHandler(
nReps=1,
method=‘random’,
extraInfo=expInfo,
originPath=-1,
trialList=data.importConditions(“nabonda.csv”),
seed=None,
name=‘myData’)
I have only one import statement which is shown in the picture above. I replaced it with the code that you suggested and also changed the name of the .CSV file.
The problem is, the error still shows in the old code, even if i have removed it and replaced it with the one you suggested.
After you synchronise your latest changes, you may find that your browser will often still run an earlier version of your code. This is due to the old code being present in your cache. Try refreshing your experiment start page using Ctrl-F5, Ctrl-Shift-R or equivalent). You may also need to disable the cache via Network conditions in the browser console. When you have developer tools showing you can also press and hold the page refresh icon and select Empty Cache and Hard Reload.
Other alternatives are using an incognito tab or a different browser or device.
Your participants will not normally experience this issue, since they should not have an earlier experiment of your code in their cache, unless they have been helping you pilot your study.
I’m trying to do the experiment in a different PC altogether.
Here, when I’m starting to write a If loop in the code component where the setting is set to Auto → JS, it shows an error as follows: