question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

return ERROR string on some translation

See original GitHub issue

Hi ! Thank you for your great work, I can’t deny the fact that this is so useful on the project I am trying on 😃 I highly recommend this work of yours.

I just have encounter this return ERROR string, I hope to resolve or pin point what might be wrong while translating the text

I’m actually running 38K+ translation in 4 threads’

google_translator(timeout=10,proxies={'http':'159.203.61.169:8080'})

lang_src='zh' to lang_tgt='en'

text: 這是……<size=24>欸欸欸——??</size>\n難道你想和我<color=#CA2E0AFF>在噴泉前留下紀念照</color>嗎?這主意太棒了,如此就能帶走最喜愛的風景了!我先去噴泉前面等你~快,快!

result : ERROR

EDIT:

Upon checking I think it’s the \n that cause the error.

work around : just put some wrapper in it to be able to pass the translation

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
lushan88acommented, Nov 26, 2020

Thanks for you question. I try use your text . But i don’t get error.

t = google_translator(timeout=10)
text = "這是……<size=24>欸欸欸——??\n難道你想和我<color=#CA2E0AFF>在噴泉前留下紀念照嗎?這主意太棒了,如此就能帶走最喜愛的風景了!我先去噴泉前面等你~快,快!"
print(text)
text_trans = t.translate(text,lang_src='zh',lang_tgt='en')
print(text_trans)

-> This is… <size=24> Hey Hey–? ? Do you want to <color=#CA2E0AFF> with me to leave a souvenir photo in front of the fountain? This is a great idea, so you can take away your favorite scenery! I’ll wait for you in front of the fountain~ Quick, quick!

Can you tell the detail for your error?

0reactions
hockeymikeycommented, Nov 27, 2020

@lushan88a Yep, I just installed it like yesterday, so it’s 1.1.1. My code is exactly as you posted. Nothing different, and the lang codes are valid. So debugging ‘[[“wrb.fr”,“MkEWBc”,null,null,null,[13],]’ is constructed and called on that first json that it errors on. If you add another bracket at the end and then you escape out the double quotes it works. I can’t figure out to replace those double quotes because it turns them into double backslash double quotes, but testing with a static string with it manually escaped out proved working in my tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is str.translate() returning an error and how can I fix it?
Show activity on this post. the error message is TypeError: translate() takes exactly one argument (2 given) . How can I format this...
Read more >
Get a translate error string response - Akamai TechDocs
Returns the status of the asynchronous Translate error string request. For operations with the SUCCESS status, the response includes also details about the ......
Read more >
Return and handle an error - The Go Programming Language
Add an if statement to check for an invalid request (an empty string where the name should be) and return an error if...
Read more >
Error Handling - A Gentle Introduction to Rust
Error handling in Rust can be clumsy if you can't use the question-mark operator. To achieve happiness, we need to return a Result...
Read more >
Recoverable Errors with Result - The Rust Programming ...
The type of E used in the error value is std::io::Error . This return type means the call to File::open might succeed and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found