Same Code for CSV reader doesn't work

The following code is identical to code in other places in my project. All of them work except this one. It causes an error saying that the csv doesn’t have a reader. I do have import csv at the initialization. This is code I copied and pasted into an existing button script to update the screen from the same file that was just modified by the button.

###########################################################################
#         Retrieve and Refresh the data from the file
###########################################################################	
	FileIn = open(FileSaveName)
	AlarmCSVData = csv.reader(FileIn)
	# Create a List of strings to use as a header for the dataset. 
	header = AlarmCSVData.next()
	# Create a dataset with the header and the rest of Alarm CSV.
	AlarmDataset = system.dataset.toDataSet(header ,list(AlarmCSVData))
	# Store it into the table.
	system.gui.getParentWindow(event).getComponentForPath('Root Container.Container.AlarmTable').data = AlarmDataset
	FileIn.close()

Solved my own problem. Realized ‘csv’ was being used as a variable name in beginning part of original code. Pasting in this from another script created a conflict in the name.

2 Likes