I am facing problem while running python code. Following is the program which read files where labels have been declared and add it by following the condition. Labels are not declared as array but I am unable to get why the following error shows.
Please have a look on it and give suggestions in order to rectify this error.
This program is too large so I copied here only that portion where labels are in process.
-
labels = set()
-
-
transcriptPath = options.root + options.transcriptFilename ## this is a path from where labels written in file
-
-
for line in file(transcriptPath).readlines():
-
if line <> "" and line[0] <> '#' and line[0] <> '.' and line[0] <> '"':
-
labels.add(line[:-1])
-
-
labels = list(labels)
-
labels.sort()
-
print len(labels) , "labels:"
-
print labels
-
-
Traceback (most recent call last):
File "IAM_online.py", line 284, in <module>
netcdf_helpers.createNcStrings(ncfile,'labels',lab els,('numLabels','maxLabelLength'),'target labels')
File "/home/ahmed/Thesis/root/netcdf_helpers.py", line 31, in createNcStrings
createNcVar(ncfile,vname,nullStrings,'c',dims,desc )
File "/home/ahmed/Thesis/root/netcdf_helpers.py", line 13, in createNcVar
nc_var.assignValue(data)
ValueError: setting an array element with a sequence