Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: too many values to unpack (expected 1) #644

Open
andashologu opened this issue Apr 18, 2021 · 0 comments
Open

ValueError: too many values to unpack (expected 1) #644

andashologu opened this issue Apr 18, 2021 · 0 comments

Comments

@andashologu
Copy link

Hello there I have created a python file that I can use to send a message to my own ID, I get this error below. When i trace back the error I find it to be in the _client.py file. I have figured out the problem but I dont have solution.

from line 48 to 58 of the _client.py file we have this code below

for x in j:
    if "error_results" in x:
        del rtn[-1]
        continue
        _util.handle_payload_error(x)
    [(key, value)] = x.items()
    _util.handle_graphql_errors(value)
    if "response" in value:
        rtn[int(key[1:])] = value["response"]
    else:
        rtn[int(key[1:])] = value["data"]

which result in this error

[(key, value)] = x.items()
ValueError: too many values to unpack (expected 1)

I found out that the error itself is supposed to be variable 'x' is not defined. I tried to look what variable 'x' is defined to, before it can used. Before line 48 I did not see anything defining x, x is not even visible before line 48, but in line 48 and onwards x is used to perform tasks without x being defined

my question now is , what is the value of x ?

Check ful error l below , and please help me out:

/Users/(name)/FBMANAGER/venv/bin/python /Users/anda/FBMANAGER/main.py
Email:***********@gamil.com
Password:**********
Logging in ******@gmail.com...
Login of kmelodies5722@gmail.com successful.
Message: Hi
Traceback (most recent call last):
File "/Users/anda/FBMANAGER/main.py", line 18, in
client.sendMessage(Message(text=msg), thread_id=thread_id, thread_type=ThreadType.USER)
File "/Users/anda/FBMANAGER/venv/lib/python3.9/site-packages/fbchat/_client.py", line 1067, in sendMessage
return self.send(
File "/Users/anda/FBMANAGER/venv/lib/python3.9/site-packages/fbchat/_client.py", line 1063, in send
return self._doSendRequest(data)
File "/Users/anda/FBMANAGER/venv/lib/python3.9/site-packages/fbchat/_client.py", line 1039, in _doSendRequest
mid, thread_id = self._state._do_send_request(data)
File "/Users/anda/FBMANAGER/venv/lib/python3.9/site-packages/fbchat/_state.py", line 313, in _do_send_request
j = self._post("/messaging/send/", data)
File "/Users/anda/FBMANAGER/venv/lib/python3.9/site-packages/fbchat/_state.py", line 243, in _post
return _graphql.response_to_json(content)
File "/Users/anda/FBMANAGER/venv/lib/python3.9/site-packages/fbchat/_graphql.py", line 53, in response_to_json
[(key, value)] = x.items()
ValueError: too many values to unpack (expected 1)

Process finished with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant