-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: not enough values to unpack (expected 2, got 1) #372
Comments
calling translate also results in in exception because in _validate_translation function result.strip() is trying to strip a list. |
I keep getting the same error when calling detect_language. Perhaps they changed changed their translate API again. Need a fix 😩 |
Running into same issue starting today. Surprisingly this library was pip installed a month back and working. Does this library get auto updated (which is not supposed to happen) |
same issueFile "/home/deepak/miniconda3/lib/python3.8/site-packages/textblob/blob.py", line 568, in detect_language |
Its not related to an update afaik.. And no update was released to pypi as well. It uses Google's translation API to do the thing. Most probably they've changed something up causing this to fall. We really need a good fix fast cause there's nothing better than this for this task |
In the mean time I took the relevant functions and did some modifications to make it work. You guys can just copy this code and it will work (just fix some minor issues that created while copy pasting my code): from textblob.exceptions import NotTranslated headers = { translate_url = "http://translate.google.com/translate_a/t?client=webapp&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at&ie=UTF-8&oe=UTF-8&otf=2&ssel=0&tsel=0&kc=1" language = detect(source="some text in any language") def detect(source, host=None, type_=None): def request(url, host=None, type=None, data=None):
def calculate_tk(source):
|
this worked...why dont you pr and do this?? |
Because I'm not a contributor... Just solved it for myself and decided to share. |
Is this still working for you? 🤔 |
Seems they changed the api back to what it used to be so you can move back to the original way you used it |
verified - you are right. |
During a multiple value assignment, the ValueError: not enough values to unpack occurs when either you have fewer objects to assign than variables, or you have more variables than objects. This error caused by the mismatch between the number of values returned and the number of variables in the assignment statement. This error happened mostly in the case of using python split function. Verify the assignment variables. If the number of assignment variables is greater than the total number of variables, delete the excess variable from the assignment operator. The number of objects returned, as well as the number of variables available are the same. To see what line is causing the issue, you could add some debug statements like this:
This will resolve the value error. |
I keep getting this error when calling detect_language.
This has started happening today only.
The text was updated successfully, but these errors were encountered: