Python: ValueError: too many values to unpack

I try to write a code with twitter api on GAE,
I got the error with the code. Please help!
the values of k and v are
since_id
13006077493

Status: 500 Internal Server Error
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 773

<pre>Traceback (most recent call last):
  File &quot;C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py&quot;, line 511, in __call__
    handler.get(*groups)
  File &quot;D:\Workspaces\fmnbots\sample.py&quot;, line 82, in get
    secret=user_secret,additional_params=params1,protected=False,method=urlfetch.GET)
  File &quot;D:\Workspaces\fmnbots\oauth.py&quot;, line 188, in make_request
    return self.make_async_request(url, token, secret, additional_params, protected, method).get_result()
  File &quot;D:\Workspaces\fmnbots\oauth.py&quot;, line 177, in make_async_request
    method)
  File &quot;D:\Workspaces\fmnbots\oauth.py&quot;, line 146, in prepare_request
    [k] = tmp.encode('utf8')
ValueError: too many values to unpack
</pre>
for k,v in params.items():
        if isinstance(v, unicode):
            print k
            print v
***         [k] = v.encode('utf8')

Open in new window

fxp007Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peprCommented:
If the intention is to convert the unicode string into the serie of bytes, then you may forgot to write the dictionary identifier at the begining of the line 5, like:

          param[k] = v.encode('utf8')

Otherwise  
    [k] = something
is probably the same as
    (k) = something
which is more usual for cases like
    (a, b) = something
which is usually written without parentheses
     a, b = something

The meaning is that the 'something' is iterated and the values are assigned to a, and b respectively. In the last case, the something must have exactly two items.

Back to your case, you try to iterate through resulting sequence of bytes, but there is more of them than of the variables at the left of the assignment.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.