473,383 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ValueError: setting an array element with a sequence

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()
  2.  
  3. transcriptPath = options.root + options.transcriptFilename ## this is a path from where labels written in file
  4.  
  5. for line in file(transcriptPath).readlines():
  6.     if line <> "" and line[0] <> '#' and line[0] <> '.' and line[0] <> '"':
  7.         labels.add(line[:-1])
  8.  
  9. labels = list(labels)
  10. labels.sort()
  11. print len(labels) , "labels:"
  12. print labels
  13.  
  14.  

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
Aug 28 '11 #1
4 8326
bvdet
2,851 Expert Mod 2GB
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
dwblas
626 Expert 512MB
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
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

netcdf_variable.assignValue(value)

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
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

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

Similar topics

7
by: richbl | last post by:
Hello all, I have a question about unserializing a single array element from a serialized array. Can this be done, or must I first unserialize the array, and then access the element? For...
2
by: csx | last post by:
Hi all, Here's a simple problem I'm having problems with. How do I pass an array element to a function. For instance, values = new values(1, 1,'A',0); values = new values(2, 2,'B',1);...
3
by: Kaz Kylheku | last post by:
Given some class C with array T x, is it possible to get a pointer-to-data-member to one of the elements? &C::x gives us a pointer-to-member-array: T (C::*). But I just want to get a T C::*...
4
by: garak | last post by:
Hi, I got the following problem : I have an defined an Array of different Actions: public PRootActions AllActions = new PRootActions ; I got a dynamic method where all Actions or other...
5
by: jtougas | last post by:
What is the way to the type of an array's elements? Array a = new long { 1, 2, 3 }; Type t = a.GetType(); Console.WriteLine( t.FullName ); This will write "System.Int64", but is not what I'm...
7
by: Michael Bray | last post by:
Let's say I am using reflection to analyze my classes, and I have an array of another class. How do I get the base class that forms the array from a type? public class A { } A MyArray =...
2
by: getteddy | last post by:
hi i am working on array , i am facing a problem in comparing data base element with array element if not (objrs("namephase")=("despArray(ctr,0)+despArray(ctr,3)")) then or If...
0
by: rval | last post by:
I have this schema while teh following sequence <complexType name="SetOfTasks" mixed="true"> <sequence> <choice minOccurs="1" maxOccurs="unbounded"> <element minOccurs="0"...
1
by: VanKha | last post by:
Please explain for me the array-based sequence ! My textbook says that " position store element and rank , and sequence is an array store positions(in this array implementation".So why store the rank...
1
by: David Williams | last post by:
Hello all, I was wondering if there was a way to set an array internal pointer to the array element in one step rather than running a loop where you use next() or prev() until you stop at the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.