Re: Too Many Values To Unpack

2009-11-21 Thread Steven D'Aprano
Traceback (most recent call last): File "", line 1, in ValueError: need more than 1 value to unpack >>> >>> for x, y in {'parrot':1}: ... pass ... Traceback (most recent call last): File "", line 1, in ValueError: too many values to unpack Strings are iterable, and so unpack into individual characters. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Too Many Values To Unpack

2009-11-21 Thread Gregory Ewing
Dennis Lee Bieber wrote: I apparently thought "for ... in dictionary" would return (key, value) pairs, but it appears that it only returns the key itself -- and a single key can't be unpacked. Misleading error... too many /targets/ to unpack... My guess is that the keys are st

Re: Too Many Values To Unpack

2009-11-21 Thread Carsten Haese
Victor Subervi wrote: > File "/var/www/html/angrynates.com/cart/catTree.py > <http://angrynates.com/cart/catTree.py>", line 25, in getChildren > for (nm, dt) in levelDict: > ValueError: too many values to unpack > > Please advise. I already explained

Re: Too Many Values To Unpack

2009-11-21 Thread Victor Subervi
Tree) File "/var/www/html/angrynates.com/cart/catTree.py", line 25, in getChildren for (nm, dt) in levelDict: ValueError: too many values to unpack Please advise. TIA, V -- http://mail.python.org/mailman/listinfo/python-list

Re: Too Many Values To Unpack

2009-11-20 Thread Carsten Haese
Victor Subervi wrote: > Now what I don't understand about the above code, provided by Dennis Lee > Bieber, is the "expand" statement. It's not a statement. It's a function. The function is defined in your code. Or rather, it's defined in the code that you copied from Dennis Lee Bieber, apparently.

Re: Too Many Values To Unpack

2009-11-20 Thread Victor Subervi
On Fri, Nov 20, 2009 at 12:14 PM, Shashank Singh < shashank.sunny.si...@gmail.com> wrote: > Are you sure your key values are 2-tuples in levelDict? > No. Here's some tweaked code: cursor.execute('select category from categories order by category') theTree = expand(cursor.fetchall())

Re: Too Many Values To Unpack

2009-11-20 Thread Carsten Haese
nippage...] > > [Fri Nov 20 07:41:11 2009] [error] [client 208.84.198.58] for (nm, > dt) in levelDict: > [Fri Nov 20 07:41:11 2009] [error] [client 208.84.198.58] ValueError: > too many values to unpack Iterating over a dictionary, such as what you're doing in the line <&g

Re: Too Many Values To Unpack

2009-11-20 Thread Shashank Singh
On Fri, Nov 20, 2009 at 9:15 PM, Victor Subervi wrote: > Hi; > At one point Dennis Lee Bieber helped me with the following slightly > modified code: > > #!/usr/bin/python > > import sys,os > sys.path.append(os.getcwd()) > import MySQLdb > from login import login > import re, string > > def printTr

Too Many Values To Unpack

2009-11-20 Thread Victor Subervi
009] [error] [client 208.84.198.58] File "/var/www/html/angrynates.com/cart/catTree.py", line 71, in catTree [Fri Nov 20 07:41:11 2009] [error] [client 208.84.198.58] getChildren(theTree) [Fri Nov 20 07:41:11 2009] [error] [client 208.84.198.58] File "/var/www/html/angrynates.co

Re: ValueError: too many values to unpack,>>>

2007-09-28 Thread Bruno Desthuilliers
J. Clifford Dyer a écrit : > On Thu, Sep 27, 2007 at 09:50:26PM +0200, Bruno Desthuilliers wrote > regarding Re: ValueError: too many values to unpack,>>>: >> Shawn Minisall a ?crit : (snip) >>> I did and it printed everything up until the 3rd line with 3 >>&

Re: ValueError: too many values to unpack

2007-09-27 Thread Pablo Ziliani
Zentrader wrote: > On Sep 27, 9:46 am, Shawn Minisall <[EMAIL PROTECTED]> wrote: > >> line 3 - 19.1829.1578.75212.10 >> line 4 - 10020410.29 >> And this is the code I'm using: >> >>#read withdrawls from file on line3 >>line = infile.readline() >> #split withdrawl

Re: ValueError: too many values to unpack

2007-09-27 Thread Zentrader
On Sep 27, 9:46 am, Shawn Minisall <[EMAIL PROTECTED]> wrote: > I am trying to read a few lines of a file with multiple values, the rest > are single and are reading in fine. > > With the multiple value lines, python says this "ValueError: too many > values to unpack&q

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread J. Clifford Dyer
On Thu, Sep 27, 2007 at 09:50:26PM +0200, Bruno Desthuilliers wrote regarding Re: ValueError: too many values to unpack,>>>: > > Shawn Minisall a ?crit : > > Fredrik Lundh wrote: > > > >> Shawn Minisall wrote: > >> > >> > >> >

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread Steve Holden
;>> File "", line 1, in >>> main() >>> File "I:\COMPUTER PROGRAMMING CLASS\PROJECT #1\project1.py", line 33, >>> in main >>> deposit1, deposit2, deposit3 = string.split(line, "\t") >>> ValueError: too many

Re: ValueError: too many values to unpack

2007-09-27 Thread George Sakkis
On Sep 27, 12:46 pm, Shawn Minisall <[EMAIL PROTECTED]> wrote: > I am trying to read a few lines of a file with multiple values, the rest > are single and are reading in fine. > > With the multiple value lines, python says this "ValueError: too many > values to unpack&q

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread Bruno Desthuilliers
ent call last): >>> File "", line 1, in >>> main() >>> File "I:\COMPUTER PROGRAMMING CLASS\PROJECT #1\project1.py", line >>> 33, in main >>> deposit1, deposit2, deposit3 = string.split(line, "\t") >>> ValueE

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread Shawn Minisall
main() >> File "I:\COMPUTER PROGRAMMING CLASS\PROJECT #1\project1.py", line 33, >> in main >> deposit1, deposit2, deposit3 = string.split(line, "\t") >> ValueError: too many values to unpack >> > > instead of fumbling around in

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread Fredrik Lundh
JECT #1\project1.py", line 33, > in main > deposit1, deposit2, deposit3 = string.split(line, "\t") > ValueError: too many values to unpack instead of fumbling around in the dark, try inserting a print statement before the offending line, so you can see what you're t

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread Shawn Minisall
Marc 'BlackJack' Rintsch wrote: > On Thu, 27 Sep 2007 12:36:58 -0400, Shawn Minisall wrote: > > >> With the multiple value lines, python says this "ValueError: too many >> values to unpack" >> >> I've googled it and it says that happen

ValueError: too many values to unpack

2007-09-27 Thread Shawn Minisall
I am trying to read a few lines of a file with multiple values, the rest are single and are reading in fine. With the multiple value lines, python says this "ValueError: too many values to unpack" I've googled it and it says that happens when you have too few or too many str

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread Marc 'BlackJack' Rintsch
On Thu, 27 Sep 2007 12:36:58 -0400, Shawn Minisall wrote: > With the multiple value lines, python says this "ValueError: too many > values to unpack" > > I've googled it and it says that happens when you have too few or too > many strings that don't matc

ValueError: too many values to unpack,>>>

2007-09-27 Thread Shawn Minisall
I am trying to read a few lines of a file with multiple values, the rest are single and are reading in fine. With the multiple value lines, python says this "ValueError: too many values to unpack" I've googled it and it says that happens when you have too few or too many str

Re: ValueError: too many values to unpack

2007-04-11 Thread Bruno Desthuilliers
Laszlo Nagy a écrit : (snip) > Try this instead: > > lineno = 0 > for values in csvreader: >try: > lineno += 1 Laszlo, may I suggest using enumerate() here instead ?-) for lineno, row in enumerate(csvreader): print "line %s" % lineno+1 # want 1-based numbering -- http://mail.python

Re: ValueError: too many values to unpack

2007-04-11 Thread fscked
You guys have given me some great ideas, I am going to try them all out and let you guys know how it turns out. On a side note, thanks for nto bashing a noob like me who isn't the greatest pythonista around. I am trying to learn and you guys are how I learn my mistakes. Well you, and the fact the

Re: ValueError: too many values to unpack

2007-04-11 Thread John Machin
On Apr 12, 5:28 am, "fscked" <[EMAIL PROTECTED]> wrote: > On Apr 11, 10:26 am, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > > > > > fscked írta:> Trying to use CSV to read in a line with 11 fields and I keep > > getting > > > this error. I have googled a bit and have been unable to figure it out. > >

Re: ValueError: too many values to unpack

2007-04-11 Thread Gabriel Genellina
En Wed, 11 Apr 2007 16:28:08 -0300, fscked <[EMAIL PROTECTED]> escribió: >> Trying to use CSV to read in a line with 11 fields and I keep getting >> this error. I have googled a bit and have been unable to figure it > > myfile = open('ClientsXMLUpdate.csv') > csvreader = csv.reader(myfile) > > f

Re: ValueError: too many values to unpack

2007-04-11 Thread Laszlo Nagy
> Hmm, well I have counted the fields in the CSV and verified there are > only 11. Here is the offending code: > > Try this instead: lineno = 0 for values in csvreader: try: lineno += 1 boxid, mac, activated, hw_ver, sw_ver, heartbeat, name, address,phone, country, ci

Re: ValueError: too many values to unpack

2007-04-11 Thread fscked
On Apr 11, 10:26 am, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > fscked írta:> Trying to use CSV to read in a line with 11 fields and I keep > getting > > this error. I have googled a bit and have been unable to figure it out. > > Probably you have more than 11 values in some (or all) of the rows in

Re: ValueError: too many values to unpack

2007-04-11 Thread Laszlo Nagy
fscked írta: > Trying to use CSV to read in a line with 11 fields and I keep getting > this error. I have googled a bit and have been unable to figure it out. > > Probably you have more than 11 values in some (or all) of the rows in the CSV file. Try this code: L = (1,2,3,4,5) a1,a2,a3 = L If

Re: ValueError: too many values to unpack

2007-04-11 Thread [EMAIL PROTECTED]
That happens when you try something like this: a,b,c = [1,2,3,4] It means there are more items on the right side than the left. You probably have < 11 variables on the left side. On Apr 11, 10:13 am, "fscked" <[EMAIL PROTECTED]> wrote: > Trying to use CSV to read in a line with 11 fields and I

ValueError: too many values to unpack

2007-04-11 Thread fscked
Trying to use CSV to read in a line with 11 fields and I keep getting this error. I have googled a bit and have been unable to figure it out. -- http://mail.python.org/mailman/listinfo/python-list

Re: ValueError: too many values to unpack

2006-06-08 Thread k . retheesh
unScript > > exec codeObject in __main__.__dict__ > > File "Q:\PythonScripts\InventoryCompareCase.py", line 234, in ? > > main() > > File "Q:\PythonScripts\InventoryCompareCase.py", line 117, in main > > for (Type,FileType,Item,Hash,Path,Size,Cul

Re: ValueError: too many values to unpack

2006-06-08 Thread alisonken1
> File "Q:\PythonScripts\InventoryCompareCase.py", line 117, in main > for (Type,FileType,Item,Hash,Path,Size,CullCd,Ext,DtCr,DtLMd,DtLAc) > in infoDiffs : > ValueError: too many values to unpack > > Thanks > Retheesh The "too many values to unpack" in

ValueError: too many values to unpack

2006-06-08 Thread k . retheesh
ype,Item,Hash,Path,Size,CullCd,Ext,DtCr,DtLMd,DtLAc) in infoDiffs : ValueError: too many values to unpack Thanks Retheesh -- http://mail.python.org/mailman/listinfo/python-list