Failed to save data from the experiment properly

Hey all,
PsychoPy version (e.g. 1.84.x): v2022.2.4

What are you trying to achieve?:
I build an experiment and I want to save on each routine data to a cvs file in numbers of colums (that I decide their names) on the file.
the columns should be:
#column 1 = “what presented”
#column 2 = “routine time”
#column 3 = “movie name”
#column 4 = “movie time”
#column 5 = “continious rate vector”
#column 6 = “continious rate timing vector”
#column 7 = “questions rate vector”
#column 8 = “questions answer”
#column 9 = “questions timing”
#column 10 = “questions slide timing”
#column 11 = ‘text input’
#column 12 = ‘condition’

On the end of each routine, I want to add to each column the data I collected from the specific routine.
If no data was collected on one of the columns, I want to add 'None" under those columns.

What did you try to make it work?:
for each routine I added code component. on the end of each routine (I mean under the ‘end routine’ tab) I used the function ‘thisExp.addData’ as follows:
thisExp.addData(“what presented”, name-of-image)
thisExp.addData(“routine time”, routine-time)
and so on.

the problem is when I check the data file in the end of the experiment I found out that some of the routines are missing, and no data is collected for them.
for example, the ‘SLIDE_CHECKBOX’ is not appearing at all.
please help me, thanks a lot!

I’m adding screenshots of the builder, the code I wrote on the code component and the excel file.

The line I marked is the line where the data from the “SLIDE_CHECKBOX” routine is suppose to appear:


I do not know whether this is the reason for your problem. You write

but in the quoted code-element, you use

thisExp.addData(X1, "Check Box Slide")

shouldn’t it be or do both versions work?

thisExp.addData("Check Box Slide", X1)

Best wishes Jens

it is still not working. does anyone can help?
maybe someone can provide a better way to save any kind of data from the exp?


I am afraid but you need to show us more from your experiment. So, how are the Xn related to the routine you are showing? PsychoPy automatically stores quite a couple of variables, e.g. condition, movie name aso.

Also, some reaction-components, e.g. the slider-component, would store “None” as a response if no response was given. With your current approach you would set nearly all “Xn” to “None”.

Best wishes Jens

In each routine I inserted a code component, and in the “end routine” tab I wrote the code with the Xn and the ThisExp.addData(Xi, “…”).
I expected that each routine will add data to the data file because of this code I added. there is some entries (I mean, some Xi) where I chose to give them “None” because there was nothing to add for them on the specific routine.
for example, there is routine that show a movie and use a slider component. I want to save the following data in this routine:

  1. movie name
  2. movie length
  3. user rate (as vector)

in order to achieve it, created the Xn variables and for each routine that relevant for the compatible description of a specific Xi, I added a value. Else, I added “None”.
the Xn are variables that describe the name of the column where I want to add the value I collected from the exp…


The slider-component saves “None” if there is no response but the routine has ended.

Are you reading the movie from an Excel file? If so, PsychoPy stores the name of the movie file in the data file, doesn’t it?

You can get the movie duration by accessing the duration() property VlcMovieStim — PsychoPy v2023.2.0 for the vlc library.

Note that the syntax for thisExp.addData is

thisExp.addData('name', value)

so in your case it is

thisExp.addData('X1', 'None')

It might be best if you provide a toy version of your experiment, just the routine that does not work with an example movie.

Best wishes, Jens