psychopy.org | Reference | Downloads | Github

Filename set in builder GUI not reflected in actual filename

MacOS 10.14.6, PsychoPy 3.2.4

When updating the desired filename in the Builder Gui, ie Experiment Settings > Data tab > Data filename field, this is not correctly reflected in the actual filename.

It seems to default to exptInfo(['participant'])_exptInfo(['date'])

Even if I set the desired filename to something simple (ensuring no code error in making a complex string) like 'my_experiment' then it still is not reflected in the actual filename.

I’ve got a workaround where I manually specify the experiment in a code block. But it’s not ideal as that doesn’t seem to affect the names of the .log or .psydat output files.

Anyone got any pointers, or have I found a bug?

@drbenvincent, seems to work for me, I am not sure what you are doing exactly, but try the following. Your filename is a string, that uses string formatting to add variables. So, first make sure the whole entry for Data filename is visible. Then, make sure each of the %s entries in the string have a corresponding value in the tuple that follows the string.

u'data/myData_%s' % (expName)  # gives filename myData_myExperimentName.csv

This is equivalent to

u'data/myData_{name}'.format(name=expName)

Thanks. At first I thought it was because I was using f-strings, but it does in fact seem to work now. I guess it was just a typo I was making in constructing the filename perhaps. Anyway, thanks.

Sorry to bother you, I have met the same question.

I have changed “Experiment Settings > Data tab > Data filename field”. Also, I checked my .py document, each of the %s entries in the string do have a corresponding value in the tuple that follows the string. Followings are:

But when I run my experiment online, the filename still starts with “participant” instead of “Number” that I have set before.

I am very confused, thanks for your attention and your help~

As per my other post, online makes all the difference.

1 Like