ValueError: too many values to unpack

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • k.retheesh@gmail.com

    #1

    ValueError: too many values to unpack

    Hi,

    I am very new to pyton, during my adventures journey I got the
    following error message which am not able to solve, can somebody help
    me. I was trying to format my output in a readable way,

    Compare results in tblItem
    _______________ _______________ _______________ _______________ _______________ _____
    71 records found in pctrsqlstage case9125
    71 records found in qa-sql2\pctr case9126
    Database counts match: True
    --------------------------------------------------------------------------------
    71 unique records found in pctrsqlstage case9125
    71 unique records found in qa-sql2\pctr case9126
    56 records were different
    Type, FileType,
    Item,
    Hash,

    Path, Size, CullCd, Ext, DtCr,
    DtLMd, DtLAc
    Traceback (most recent call last):
    File
    "C:\Python24\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
    line 310, in RunScript
    exec codeObject in __main__.__dict __
    File "Q:\PythonScrip ts\InventoryCom pareCase.py", line 234, in ?
    main()
    File "Q:\PythonScrip ts\InventoryCom pareCase.py", line 117, in main
    for (Type,FileType, Item,Hash,Path, Size,CullCd,Ext ,DtCr,DtLMd,DtL Ac)
    in infoDiffs :
    ValueError: too many values to unpack

    Thanks
    Retheesh

  • alisonken1

    #2
    Re: ValueError: too many values to unpack


    k.retheesh@gmai l.com wrote:
    <snip>[color=blue]
    > 56 records were different
    > Type, FileType,
    > Item,
    > Hash,
    >
    > Path, Size, CullCd, Ext, DtCr,
    > DtLMd, DtLAc
    > Traceback (most recent call last):
    > File
    > "C:\Python24\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
    > line 310, in RunScript
    > exec codeObject in __main__.__dict __
    > File "Q:\PythonScrip ts\InventoryCom pareCase.py", line 234, in ?
    > main()
    > File "Q:\PythonScrip ts\InventoryCom pareCase.py", line 117, in main
    > for (Type,FileType, Item,Hash,Path, Size,CullCd,Ext ,DtCr,DtLMd,DtL Ac)
    > in infoDiffs :
    > ValueError: too many values to unpack
    >
    > Thanks
    > Retheesh[/color]

    The "too many values to unpack" indicates you don't have enough
    variables in the [for (...) in infoDiffs: ] construct.

    You also may want to change some of the names; although "Type"
    (variable name) and "type" (python function) should be different, it's
    good practice to not use names that are similar to functions.

    Comment

    • k.retheesh@gmail.com

      #3
      Re: ValueError: too many values to unpack

      Thank you, that solved my problem.

      Thanks
      Retheesh

      alisonken1 wrote:[color=blue]
      > k.retheesh@gmai l.com wrote:
      > <snip>[color=green]
      > > 56 records were different
      > > Type, FileType,
      > > Item,
      > > Hash,
      > >
      > > Path, Size, CullCd, Ext, DtCr,
      > > DtLMd, DtLAc
      > > Traceback (most recent call last):
      > > File
      > > "C:\Python24\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
      > > line 310, in RunScript
      > > exec codeObject in __main__.__dict __
      > > File "Q:\PythonScrip ts\InventoryCom pareCase.py", line 234, in ?
      > > main()
      > > File "Q:\PythonScrip ts\InventoryCom pareCase.py", line 117, in main
      > > for (Type,FileType, Item,Hash,Path, Size,CullCd,Ext ,DtCr,DtLMd,DtL Ac)
      > > in infoDiffs :
      > > ValueError: too many values to unpack
      > >
      > > Thanks
      > > Retheesh[/color]
      >
      > The "too many values to unpack" indicates you don't have enough
      > variables in the [for (...) in infoDiffs: ] construct.
      >
      > You also may want to change some of the names; although "Type"
      > (variable name) and "type" (python function) should be different, it's
      > good practice to not use names that are similar to functions.[/color]

      Comment

      Working...