print googleSpeechURL: ordinal not in range(128)
I've ran into error
$ python PiTranslate.py -o en -d ru -t "hello"
Origin: en
Destination: ru
Text: hello
Traceback (most recent call last):
File "PiTranslate.py", line 53, in
If you change
print googleSpeechURL
to
print googleSpeechURL.encode("utf-8")
this line goes fine, but next line fails:
Origin: en
Destination: ru
Text: hello
http://translate.google.com/translate_tts?tl=ru&q=Привет
Traceback (most recent call last):
File "PiTranslate.py", line 53, in
Changing subprocess.call(["mplayer",googleSpeechURL], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) to subprocess.call(["mplayer",googleSpeechURL.encode("utf-8")], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) throws no error, but no translated speech played. I guess subprocess should be called with parameters encoded in the other way.
Sometimes it throws $ python PiTranslate.py -o en -d ru -t "hello" Origin: en Destination: ru Text: hello http://translate.google.com/translate_tts?tl=ru&q=TranslateApiException: Cannot find an active Azure Market Place Translator Subscription associated with the request credentials. : ID=XXXX.V2_Json.Translate.XXXXXXXX
I've made a pull request that fixes the encoding problem.
The Azure problem is fixed by going to https://datamarket.azure.com/dataset/1899a118-d202-492c-aa16-ba21c33c06cb and "buying" the first package for $0. That solved all my Azure problems!