Error message <exceptions.TypeError unpack non-sequence>

ahsan Imam ahsan.imam at newtimes.com
Fri Feb 6 16:52:20 EST 2004
Josiah Carlson <jcarlson at nospam.uci.edu> wrote in message news:<bvv2dr$7oa$1 at news.service.uci.edu>...
> > I am trying to move an application from python 1.5.2 to 2.3. The code
> > works fine in 1.5.2 but gives the exception (exceptions.TypeError
> > unpack non-sequence) in python 2.3. I did not write this code so I am
> > not sure what is happening here.
> > 
> > Here is the code snippet:
> > 
> > for (item, agent) in self.lItems:
> >       lItems.append(interpolate(self._ITEM_FMT, id=str(item)))
> > 
> > Note:
> > self.lItems contains two elements.
> 
> Always exactly 2 items?
What if there are more than 2 items? How can I do something where
element 0 and 1 are assigned to (item, agent) and so on? If this is a
silly question please let me know what I can read.

Thanks
Ahsan



More information about the Python-list mailing list