gcloud authentication problem on TTS python script











up vote
0
down vote

favorite












I am following this document: https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries#client-libraries-install-python



I have followed the instructions. I get an error when I run the provided Python code ("Create audio data" section).



First Try:



It appears the problem is with authentication. I authenticated with gcloud init.



C:webDevpycharmTTS-Nov-Scriptspython.exe C:/webDev/pycharm/TTS-Nov-/TTS-Main.py
C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541901610.961000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.



  1. Second Try Update:


I ran this
gcloud auth activate-service-account test-2@tts-alphax-nov.iam.gserviceaccount.com --key-file="C:webDevkeysgoogle-cloudtts-alphax-nov-b101c56c70b7.json" --project=tts-alphax-nov



This resulted in:
Activated service account credentials for: [test-2@tts-alphax-nov.iam.gserviceaccount.com]
I then ran the python again and this was the error I got.



C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541903472.332000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.









share|improve this question






















  • Try this: set GOOGLE_APPLICATION_CREDENTIALS=path_to_service_credentials.json in your command prompt shell. Then try the program again.
    – John Hanley
    Nov 11 at 4:43












  • I got a slightly different (error)[docs.google.com/document/d/…
    – normandantzig
    Nov 11 at 6:13

















up vote
0
down vote

favorite












I am following this document: https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries#client-libraries-install-python



I have followed the instructions. I get an error when I run the provided Python code ("Create audio data" section).



First Try:



It appears the problem is with authentication. I authenticated with gcloud init.



C:webDevpycharmTTS-Nov-Scriptspython.exe C:/webDev/pycharm/TTS-Nov-/TTS-Main.py
C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541901610.961000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.



  1. Second Try Update:


I ran this
gcloud auth activate-service-account test-2@tts-alphax-nov.iam.gserviceaccount.com --key-file="C:webDevkeysgoogle-cloudtts-alphax-nov-b101c56c70b7.json" --project=tts-alphax-nov



This resulted in:
Activated service account credentials for: [test-2@tts-alphax-nov.iam.gserviceaccount.com]
I then ran the python again and this was the error I got.



C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541903472.332000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.









share|improve this question






















  • Try this: set GOOGLE_APPLICATION_CREDENTIALS=path_to_service_credentials.json in your command prompt shell. Then try the program again.
    – John Hanley
    Nov 11 at 4:43












  • I got a slightly different (error)[docs.google.com/document/d/…
    – normandantzig
    Nov 11 at 6:13















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am following this document: https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries#client-libraries-install-python



I have followed the instructions. I get an error when I run the provided Python code ("Create audio data" section).



First Try:



It appears the problem is with authentication. I authenticated with gcloud init.



C:webDevpycharmTTS-Nov-Scriptspython.exe C:/webDev/pycharm/TTS-Nov-/TTS-Main.py
C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541901610.961000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.



  1. Second Try Update:


I ran this
gcloud auth activate-service-account test-2@tts-alphax-nov.iam.gserviceaccount.com --key-file="C:webDevkeysgoogle-cloudtts-alphax-nov-b101c56c70b7.json" --project=tts-alphax-nov



This resulted in:
Activated service account credentials for: [test-2@tts-alphax-nov.iam.gserviceaccount.com]
I then ran the python again and this was the error I got.



C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541903472.332000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.









share|improve this question













I am following this document: https://cloud.google.com/text-to-speech/docs/quickstart-client-libraries#client-libraries-install-python



I have followed the instructions. I get an error when I run the provided Python code ("Create audio data" section).



First Try:



It appears the problem is with authentication. I authenticated with gcloud init.



C:webDevpycharmTTS-Nov-Scriptspython.exe C:/webDev/pycharm/TTS-Nov-/TTS-Main.py
C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541901610.961000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.



  1. Second Try Update:


I ran this
gcloud auth activate-service-account test-2@tts-alphax-nov.iam.gserviceaccount.com --key-file="C:webDevkeysgoogle-cloudtts-alphax-nov-b101c56c70b7.json" --project=tts-alphax-nov



This resulted in:
Activated service account credentials for: [test-2@tts-alphax-nov.iam.gserviceaccount.com]
I then ran the python again and this was the error I got.



C:webDevpycharmTTS-Nov-libsite-packagesgoogleauth_default.py:66: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:webDevpycharmTTS-Nov-libsite-packagesgrpc_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/."
debug_error_string = "{"created":"@1541903472.332000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.","grpc_status":7}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:/webDev/pycharm/TTS-Nov-/TTS-Main.py", line 26, in <module>
response = client.synthesize_speech(synthesis_input, voice, audio_config)
File "C:webDevpycharmTTS-Nov-libsite-packagesgooglecloudtexttospeech_v1gapictext_to_speech_client.py", line 257, in synthesize_speech
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:webDevpycharmTTS-Nov-libsite-packagesgoogleapi_coregrpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the texttospeech.googleapis.com. We recommend that most server applications use service accounts instead. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/.






python authentication google-cloud-platform cloud google-authentication






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 2:58









normandantzig

2916




2916












  • Try this: set GOOGLE_APPLICATION_CREDENTIALS=path_to_service_credentials.json in your command prompt shell. Then try the program again.
    – John Hanley
    Nov 11 at 4:43












  • I got a slightly different (error)[docs.google.com/document/d/…
    – normandantzig
    Nov 11 at 6:13




















  • Try this: set GOOGLE_APPLICATION_CREDENTIALS=path_to_service_credentials.json in your command prompt shell. Then try the program again.
    – John Hanley
    Nov 11 at 4:43












  • I got a slightly different (error)[docs.google.com/document/d/…
    – normandantzig
    Nov 11 at 6:13


















Try this: set GOOGLE_APPLICATION_CREDENTIALS=path_to_service_credentials.json in your command prompt shell. Then try the program again.
– John Hanley
Nov 11 at 4:43






Try this: set GOOGLE_APPLICATION_CREDENTIALS=path_to_service_credentials.json in your command prompt shell. Then try the program again.
– John Hanley
Nov 11 at 4:43














I got a slightly different (error)[docs.google.com/document/d/…
– normandantzig
Nov 11 at 6:13






I got a slightly different (error)[docs.google.com/document/d/…
– normandantzig
Nov 11 at 6:13














1 Answer
1






active

oldest

votes

















up vote
0
down vote













This error message is usually thrown when the application is not being authenticated correctly due to several reasons such as missing files, invalid credential paths, incorrect environment variables assignations, among other causes. Keep in mind that when you set an environment variable value in a session, it is reset every time the session is dropped.



Based on this, I suggest you to validate that the credential file and file path are being correctly assigned (avoiding to include blank characters when setting the GOOGLE_APPLICATION_CREDENTIALS env variable), as well as try to explicitly specify your service account file directly into your code by adding the following credentials code to your solution:



from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('<serviceAccountPath>.json')

texttospeech.TextToSpeechClient(credentials=credentials)





share|improve this answer





















  • I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
    – normandantzig
    yesterday











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245462%2fgcloud-authentication-problem-on-tts-python-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













This error message is usually thrown when the application is not being authenticated correctly due to several reasons such as missing files, invalid credential paths, incorrect environment variables assignations, among other causes. Keep in mind that when you set an environment variable value in a session, it is reset every time the session is dropped.



Based on this, I suggest you to validate that the credential file and file path are being correctly assigned (avoiding to include blank characters when setting the GOOGLE_APPLICATION_CREDENTIALS env variable), as well as try to explicitly specify your service account file directly into your code by adding the following credentials code to your solution:



from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('<serviceAccountPath>.json')

texttospeech.TextToSpeechClient(credentials=credentials)





share|improve this answer





















  • I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
    – normandantzig
    yesterday















up vote
0
down vote













This error message is usually thrown when the application is not being authenticated correctly due to several reasons such as missing files, invalid credential paths, incorrect environment variables assignations, among other causes. Keep in mind that when you set an environment variable value in a session, it is reset every time the session is dropped.



Based on this, I suggest you to validate that the credential file and file path are being correctly assigned (avoiding to include blank characters when setting the GOOGLE_APPLICATION_CREDENTIALS env variable), as well as try to explicitly specify your service account file directly into your code by adding the following credentials code to your solution:



from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('<serviceAccountPath>.json')

texttospeech.TextToSpeechClient(credentials=credentials)





share|improve this answer





















  • I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
    – normandantzig
    yesterday













up vote
0
down vote










up vote
0
down vote









This error message is usually thrown when the application is not being authenticated correctly due to several reasons such as missing files, invalid credential paths, incorrect environment variables assignations, among other causes. Keep in mind that when you set an environment variable value in a session, it is reset every time the session is dropped.



Based on this, I suggest you to validate that the credential file and file path are being correctly assigned (avoiding to include blank characters when setting the GOOGLE_APPLICATION_CREDENTIALS env variable), as well as try to explicitly specify your service account file directly into your code by adding the following credentials code to your solution:



from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('<serviceAccountPath>.json')

texttospeech.TextToSpeechClient(credentials=credentials)





share|improve this answer












This error message is usually thrown when the application is not being authenticated correctly due to several reasons such as missing files, invalid credential paths, incorrect environment variables assignations, among other causes. Keep in mind that when you set an environment variable value in a session, it is reset every time the session is dropped.



Based on this, I suggest you to validate that the credential file and file path are being correctly assigned (avoiding to include blank characters when setting the GOOGLE_APPLICATION_CREDENTIALS env variable), as well as try to explicitly specify your service account file directly into your code by adding the following credentials code to your solution:



from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('<serviceAccountPath>.json')

texttospeech.TextToSpeechClient(credentials=credentials)






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 at 14:40









Armin_SC

82427




82427












  • I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
    – normandantzig
    yesterday


















  • I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
    – normandantzig
    yesterday
















I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
– normandantzig
yesterday




I ran into some problems with this. Python errored out on some of the google modules. I will try to get the errors posted
– normandantzig
yesterday


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245462%2fgcloud-authentication-problem-on-tts-python-script%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python