By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,941 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,941 IT Pros & Developers. It's quick & easy.

ValueError: setting an array element with a sequence

P: 25
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.

Expand|Select|Wrap|Line Numbers
  1. labels = set()
  3. transcriptPath = options.root + options.transcriptFilename ## this is a path from where labels written in file
  5. for line in file(transcriptPath).readlines():
  6.     if line <> "" and line[0] <> '#' and line[0] <> '.' and line[0] <> '"':
  7.         labels.add(line[:-1])
  9. labels = list(labels)
  10. labels.sort()
  11. print len(labels) , "labels:"
  12. print labels

Traceback (most recent call last):
File "", line 284, in <module>
netcdf_helpers.createNcStrings(ncfile,'labels',lab els,('numLabels','maxLabelLength'),'target labels')
File "/home/ahmed/Thesis/root/", line 31, in createNcStrings
createNcVar(ncfile,vname,nullStrings,'c',dims,desc )
File "/home/ahmed/Thesis/root/", line 13, in createNcVar
ValueError: setting an array element with a sequence
Aug 28 '11 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 2.5K+
P: 2,851
According to the traceback, the error occurs with this statement: nc_var.assignValue(data)

What is nc_var and what is data? What does assignValue do?
Aug 28 '11 #2

Expert 100+
P: 621
Do you have more than one program with the same name, perhaps in different directories, and the error messages comes from a different program?
Aug 28 '11 #3

P: 25
What is nc_var and what is data? What does assignValue do?

nc_var is a netcdf varriable and data contains all the labels like A,B,C.... assignValue is a builtin function, it does has a form


Actually I am using netcdf library for my program and this error shows in library program. I am unable to sort it out.
Aug 28 '11 #4

P: 25
No I have a one program of this name in directory. I am not calling other directory's file in my program so this can not be the case.
Aug 28 '11 #5

Post your reply

Sign in to post your reply or Sign up for a free account.