Lose data file(.csv) if I press esc. to terminate the program

OS: MAC OS 10.13):
PsychoPy version (e.g. 1.85.4):
Standard Standalone? (y)

My code works fine, and responses are properly stored in a .csv file. However, if I press the esc key during the task, no .csv file will be generated. This is annoying because then I can’t testing my code without running through the whole task.

I created the task in the builder view, and haven’t changed anything regarding exiting the program.

Following are the codes related to the escape key:

    if "escape" in theseKeys:
        endExpNow = True
   if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()

Following are the trial handler code:

trials = data.TrialHandler(nReps=1, method=‘random’,
extraInfo=expInfo, originPath=-1,
trialList=data.importConditions(u’TrialList.xlsx’, selection = arr),
seed=None, name=‘trials’)
thisExp.addLoop(trials) # add the loop to the experiment
thisTrial = trials.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
if thisTrial != None:
for paramName in thisTrial.keys():
exec(paramName + ‘= thisTrial.’ + paramName)

for thisTrial in trials:
    currentLoop = trials
    # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
    if thisTrial != None:
        for paramName in thisTrial.keys():
            exec(paramName + '= thisTrial.' + paramName)

Please let me know if you need any additional portion of my code.

Thank you so much in advance!

Hi,

This seems to be an issue with the most recent PsychoPy version for macOS:

Perhaps you could use an older PsychoPy version until this is fixed?

Jan