UnboundLocalError: local variable 'trialList' referenced before assignment

Hello,
I was getting the same error when I was trying to add my .csv conditions file to a loop. Referring to some of the above answers, I ensured that there were no spaces in my column names. It turns out that Psychopy didn’t like that one of my column names had a slash (I was trying to define a variable as old/new). But I generally use underscore a lot in my column names to make it easier during data cleaning and analysis and that hasn’t given me any errors in Psychopy so far.
Hope this helps others who are getting a similar error!