When using gTTS on Pythonanywhere, with a command such as:
audio1 = gTTS(text=’text to be read’, lang=’es’, tld=’com.mx’, slow=False)
I get a message:
“gTTSError”
“Failed to connect. Probable cause: Host 'https://translate.google.com.mx/' is not reachable”
The error is “tld” dependent. tld=’com’ works, tld=’com.mx’ or tld=’com.br’ does not. The exact same code works, without errors on other systems, just not on Pythonanywhere.
Does Pythonanywhere block access to some countries, or is there another explanation of why the code works on other systems, but not on Pythonanywhere. (This is not an intermittent problem, certain tld’s never work on Pythonanywhere, but always work on other systems (same code). The Python (Python 3.1.3) and gtts (gTTS 2.5.4) versions used are the same on Pythonanywhere and on the systems that work.