Syntax Error: Importing CSV file

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): 1.5
I am trying to run my experiment which asks the ratings of concentrations and pleasantness of a given odor (I am still in the process of adding that aspect into builder view). I added a revised some custom code in builder view to save my data into a csv file. When I tried to run the task, I was given the error: “Syntax Error: invalid syntax” with an error pointed at ‘import csv’. To try and trouble shoot the issue, I have retyped ‘import csv’ in the custom code section, copy and pasted from a different section of the task that worked, and tried to delete any additional spaces that could be affecting the code.
test_concentration_task_lastrun.py (54 KB)
I have included the entire alert below:

Alert 4205: Python Syntax Error in ‘End Routine’ tab. See ’ writer.row({‘Name’:row[0],‘Response1’:row[1],‘Response2’:row[2],‘Response3’:row[3],‘Status’:row[3]}
’ on line number 27 of the ‘End Routine’ tab.
For more info see https://docs.psychopy.org/alerts/4205.html## Running: C:\Users\jordanka\Desktop\NIDA SIP_2024\test_concentration_task_lastrun.py ##
File “C:\Users\jordanka\Desktop\NIDA SIP_2024\test_concentration_task_lastrun.py”, line 1127
import csv
^
SyntaxError: invalid syntax

You have a missing bracket. Try

writer.row({'Name':row[0],'Response1':row[1],'Response2':row[2],'Response3':row[3],'Status':row[3]})