Google Cloud Speech Recognition Permission Denied Error












0















I am trying to do Google cloud Speech Recognition for personal assistant built on python. I have a service account and also have setup GOOGLE_ACCOUNT_CREDENTIALS and also have enabled the API. But its not working. This is the example code from official page.



from google.cloud import speech
client = speech.SpeechClient()
results = client.recognize(
audio=speech.types.RecognitionAudio(
uri='gs://my-bucket/recording.flac',
),
config=speech.types.RecognitionConfig(
encoding='LINEAR16',
language_code='en-US',
sample_rate_hertz=44100,
),
)
for result in results:
for alternative in result.alternatives:
print('=' * 20)
print('transcript: ' + alternative.transcript)
print('confidence: ' + str(alternative.confidence))


Error:



(base) C:Usersmnauf>C:/Users/mnauf/Anaconda3/python.exe d:/Programming/python/mic.py
Traceback (most recent call last):
File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
return callable_(*args, **kwargs)
File "C:UsersmnaufAnaconda3libsite-packagesgrpc_channel.py", line 533, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "C:UsersmnaufAnaconda3libsite-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 = "The caller does not have permission"
debug_error_string = "{"created":"@1543062997.122000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"The caller
does not have permission","grpc_status":7}"
>

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

Traceback (most recent call last):
File "d:/Programming/python/mic.py", line 10, in <module>
sample_rate_hertz=44100,
File "C:UsersmnaufAnaconda3libsite-packagesgooglecloudspeech_v1gapicspeech_client.py", line 227, in recognize
request, retry=retry, timeout=timeout, metadata=metadata)
File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
return target()
File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "C:UsersmnaufAnaconda3libsite-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 The caller does not have permission









share|improve this question





























    0















    I am trying to do Google cloud Speech Recognition for personal assistant built on python. I have a service account and also have setup GOOGLE_ACCOUNT_CREDENTIALS and also have enabled the API. But its not working. This is the example code from official page.



    from google.cloud import speech
    client = speech.SpeechClient()
    results = client.recognize(
    audio=speech.types.RecognitionAudio(
    uri='gs://my-bucket/recording.flac',
    ),
    config=speech.types.RecognitionConfig(
    encoding='LINEAR16',
    language_code='en-US',
    sample_rate_hertz=44100,
    ),
    )
    for result in results:
    for alternative in result.alternatives:
    print('=' * 20)
    print('transcript: ' + alternative.transcript)
    print('confidence: ' + str(alternative.confidence))


    Error:



    (base) C:Usersmnauf>C:/Users/mnauf/Anaconda3/python.exe d:/Programming/python/mic.py
    Traceback (most recent call last):
    File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
    return callable_(*args, **kwargs)
    File "C:UsersmnaufAnaconda3libsite-packagesgrpc_channel.py", line 533, in __call__
    return _end_unary_response_blocking(state, call, False, None)
    File "C:UsersmnaufAnaconda3libsite-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 = "The caller does not have permission"
    debug_error_string = "{"created":"@1543062997.122000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"The caller
    does not have permission","grpc_status":7}"
    >

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

    Traceback (most recent call last):
    File "d:/Programming/python/mic.py", line 10, in <module>
    sample_rate_hertz=44100,
    File "C:UsersmnaufAnaconda3libsite-packagesgooglecloudspeech_v1gapicspeech_client.py", line 227, in recognize
    request, retry=retry, timeout=timeout, metadata=metadata)
    File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
    return wrapped_func(*args, **kwargs)
    File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
    on_error=on_error,
    File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
    return target()
    File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
    return func(*args, **kwargs)
    File "C:UsersmnaufAnaconda3libsite-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 The caller does not have permission









    share|improve this question



























      0












      0








      0








      I am trying to do Google cloud Speech Recognition for personal assistant built on python. I have a service account and also have setup GOOGLE_ACCOUNT_CREDENTIALS and also have enabled the API. But its not working. This is the example code from official page.



      from google.cloud import speech
      client = speech.SpeechClient()
      results = client.recognize(
      audio=speech.types.RecognitionAudio(
      uri='gs://my-bucket/recording.flac',
      ),
      config=speech.types.RecognitionConfig(
      encoding='LINEAR16',
      language_code='en-US',
      sample_rate_hertz=44100,
      ),
      )
      for result in results:
      for alternative in result.alternatives:
      print('=' * 20)
      print('transcript: ' + alternative.transcript)
      print('confidence: ' + str(alternative.confidence))


      Error:



      (base) C:Usersmnauf>C:/Users/mnauf/Anaconda3/python.exe d:/Programming/python/mic.py
      Traceback (most recent call last):
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
      return callable_(*args, **kwargs)
      File "C:UsersmnaufAnaconda3libsite-packagesgrpc_channel.py", line 533, in __call__
      return _end_unary_response_blocking(state, call, False, None)
      File "C:UsersmnaufAnaconda3libsite-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 = "The caller does not have permission"
      debug_error_string = "{"created":"@1543062997.122000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"The caller
      does not have permission","grpc_status":7}"
      >

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

      Traceback (most recent call last):
      File "d:/Programming/python/mic.py", line 10, in <module>
      sample_rate_hertz=44100,
      File "C:UsersmnaufAnaconda3libsite-packagesgooglecloudspeech_v1gapicspeech_client.py", line 227, in recognize
      request, retry=retry, timeout=timeout, metadata=metadata)
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
      return wrapped_func(*args, **kwargs)
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
      on_error=on_error,
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
      return target()
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
      return func(*args, **kwargs)
      File "C:UsersmnaufAnaconda3libsite-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 The caller does not have permission









      share|improve this question
















      I am trying to do Google cloud Speech Recognition for personal assistant built on python. I have a service account and also have setup GOOGLE_ACCOUNT_CREDENTIALS and also have enabled the API. But its not working. This is the example code from official page.



      from google.cloud import speech
      client = speech.SpeechClient()
      results = client.recognize(
      audio=speech.types.RecognitionAudio(
      uri='gs://my-bucket/recording.flac',
      ),
      config=speech.types.RecognitionConfig(
      encoding='LINEAR16',
      language_code='en-US',
      sample_rate_hertz=44100,
      ),
      )
      for result in results:
      for alternative in result.alternatives:
      print('=' * 20)
      print('transcript: ' + alternative.transcript)
      print('confidence: ' + str(alternative.confidence))


      Error:



      (base) C:Usersmnauf>C:/Users/mnauf/Anaconda3/python.exe d:/Programming/python/mic.py
      Traceback (most recent call last):
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregrpc_helpers.py", line 59, in error_remapped_callable
      return callable_(*args, **kwargs)
      File "C:UsersmnaufAnaconda3libsite-packagesgrpc_channel.py", line 533, in __call__
      return _end_unary_response_blocking(state, call, False, None)
      File "C:UsersmnaufAnaconda3libsite-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 = "The caller does not have permission"
      debug_error_string = "{"created":"@1543062997.122000000","description":"Error received from peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"The caller
      does not have permission","grpc_status":7}"
      >

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

      Traceback (most recent call last):
      File "d:/Programming/python/mic.py", line 10, in <module>
      sample_rate_hertz=44100,
      File "C:UsersmnaufAnaconda3libsite-packagesgooglecloudspeech_v1gapicspeech_client.py", line 227, in recognize
      request, retry=retry, timeout=timeout, metadata=metadata)
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coregapic_v1method.py", line 139, in __call__
      return wrapped_func(*args, **kwargs)
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 260, in retry_wrapped_func
      on_error=on_error,
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coreretry.py", line 177, in retry_target
      return target()
      File "C:UsersmnaufAnaconda3libsite-packagesgoogleapi_coretimeout.py", line 206, in func_with_timeout
      return func(*args, **kwargs)
      File "C:UsersmnaufAnaconda3libsite-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 The caller does not have permission






      python google-cloud-platform google-speech-api






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 24 '18 at 18:28









      Maxim

      1,506210




      1,506210










      asked Nov 24 '18 at 12:48









      Muhammad RamishMuhammad Ramish

      162




      162
























          1 Answer
          1






          active

          oldest

          votes


















          1














          At the line uri='gs://my-bucket/recording.flac', change the path to your own bucket with the file you want to translate, as that bucket may indeed exist, since bucket names are unique in GCP, and you therefore have no permission to access it with your service account key.






          share|improve this answer

























            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',
            autoActivateHeartbeat: false,
            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%2f53458307%2fgoogle-cloud-speech-recognition-permission-denied-error%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









            1














            At the line uri='gs://my-bucket/recording.flac', change the path to your own bucket with the file you want to translate, as that bucket may indeed exist, since bucket names are unique in GCP, and you therefore have no permission to access it with your service account key.






            share|improve this answer






























              1














              At the line uri='gs://my-bucket/recording.flac', change the path to your own bucket with the file you want to translate, as that bucket may indeed exist, since bucket names are unique in GCP, and you therefore have no permission to access it with your service account key.






              share|improve this answer




























                1












                1








                1







                At the line uri='gs://my-bucket/recording.flac', change the path to your own bucket with the file you want to translate, as that bucket may indeed exist, since bucket names are unique in GCP, and you therefore have no permission to access it with your service account key.






                share|improve this answer















                At the line uri='gs://my-bucket/recording.flac', change the path to your own bucket with the file you want to translate, as that bucket may indeed exist, since bucket names are unique in GCP, and you therefore have no permission to access it with your service account key.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 24 '18 at 14:59

























                answered Nov 24 '18 at 14:52









                MaximMaxim

                1,506210




                1,506210






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53458307%2fgoogle-cloud-speech-recognition-permission-denied-error%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

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)