You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the code, I'd say the error is still due to the length of the string. At the moment, the code is checking for a number of characters in a string (here 1701 and 2053), which here is lower than the number of bytes (here 5035 and 6091). So it passes the condition but failed to receive a valid response from the API. By chance, you still received an answer for the shortest sample, even if it seems it is slightly oversize bitwise.
Note: in my case at first I received None as an answer for the shortest sample string; because you forgot the return statement in you function.
A way to solve this issue is probably to use the string encode method to encode the string in UTF-8 as an array of bytes. In the Python documentation about Unicode, we can read the following snippet:
Which makes me believe len(text) should be replaced by len(text.encode('UTF-8", "ignore") or len(text.encode('UTF-8", "xmlcharrefreplace"). And, maybe return the size for the string and bytes for the user when raising the error.
Thanks for the assistance, @Vincent-Stragier
Originally posted by @snjv94 in #169 (comment)
The text was updated successfully, but these errors were encountered: