ValueError: too many values to unpack (expected 1)
andashologu opened this issue · 0 comments
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