Error in Running a script: Google Speech API
I have been trying to run the following code from this link.
import io
import os
# Imports the Google Cloud client library
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
# Instantiates a client
client = speech.SpeechClient()
# The name of the audio file to transcribe
file_name = os.path.join(
os.path.dirname(__file__),
'resources',
'audio.raw')
# Loads the audio into memory
with io.open(file_name, 'rb') as audio_file:
content = audio_file.read()
audio = types.RecognitionAudio(content=content)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=16000,
language_code='en-US')
# Detects speech in the audio file
response = client.recognize(config, audio)
for result in response.results:
print('Transcript: {}'.format(result.alternatives[0].transcript))
However, I am getting the following error when I run it using python 3.4.2 on a raspberry pi.
Traceback (most recent call last):
File "script.py", line 10, in <module>
client = speech.SpeechClient()
File "/usr/local/lib/python3.4/dist- packages/google/cloud/speech_v1/gapic/speech_client.py", line 137, in __init__
credentials=credentials,
File "/usr/local/lib/python3.4/dist-packages/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py", line 76, in __init__
channel)
File "/usr/local/lib/python3.4/dist- packages/google/api_core/operations_v1/operations_client.py", line 59, in __init__
self.operations_stub = operations_pb2.OperationsStub(channel)
AttributeError: 'module' object has no attribute 'OperationsStub'
I have been trying to get over this for about 3 days now and I have not found any solution.
Any help would be appreciated.
python raspberry-pi google-speech-api
add a comment |
I have been trying to run the following code from this link.
import io
import os
# Imports the Google Cloud client library
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
# Instantiates a client
client = speech.SpeechClient()
# The name of the audio file to transcribe
file_name = os.path.join(
os.path.dirname(__file__),
'resources',
'audio.raw')
# Loads the audio into memory
with io.open(file_name, 'rb') as audio_file:
content = audio_file.read()
audio = types.RecognitionAudio(content=content)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=16000,
language_code='en-US')
# Detects speech in the audio file
response = client.recognize(config, audio)
for result in response.results:
print('Transcript: {}'.format(result.alternatives[0].transcript))
However, I am getting the following error when I run it using python 3.4.2 on a raspberry pi.
Traceback (most recent call last):
File "script.py", line 10, in <module>
client = speech.SpeechClient()
File "/usr/local/lib/python3.4/dist- packages/google/cloud/speech_v1/gapic/speech_client.py", line 137, in __init__
credentials=credentials,
File "/usr/local/lib/python3.4/dist-packages/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py", line 76, in __init__
channel)
File "/usr/local/lib/python3.4/dist- packages/google/api_core/operations_v1/operations_client.py", line 59, in __init__
self.operations_stub = operations_pb2.OperationsStub(channel)
AttributeError: 'module' object has no attribute 'OperationsStub'
I have been trying to get over this for about 3 days now and I have not found any solution.
Any help would be appreciated.
python raspberry-pi google-speech-api
add a comment |
I have been trying to run the following code from this link.
import io
import os
# Imports the Google Cloud client library
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
# Instantiates a client
client = speech.SpeechClient()
# The name of the audio file to transcribe
file_name = os.path.join(
os.path.dirname(__file__),
'resources',
'audio.raw')
# Loads the audio into memory
with io.open(file_name, 'rb') as audio_file:
content = audio_file.read()
audio = types.RecognitionAudio(content=content)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=16000,
language_code='en-US')
# Detects speech in the audio file
response = client.recognize(config, audio)
for result in response.results:
print('Transcript: {}'.format(result.alternatives[0].transcript))
However, I am getting the following error when I run it using python 3.4.2 on a raspberry pi.
Traceback (most recent call last):
File "script.py", line 10, in <module>
client = speech.SpeechClient()
File "/usr/local/lib/python3.4/dist- packages/google/cloud/speech_v1/gapic/speech_client.py", line 137, in __init__
credentials=credentials,
File "/usr/local/lib/python3.4/dist-packages/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py", line 76, in __init__
channel)
File "/usr/local/lib/python3.4/dist- packages/google/api_core/operations_v1/operations_client.py", line 59, in __init__
self.operations_stub = operations_pb2.OperationsStub(channel)
AttributeError: 'module' object has no attribute 'OperationsStub'
I have been trying to get over this for about 3 days now and I have not found any solution.
Any help would be appreciated.
python raspberry-pi google-speech-api
I have been trying to run the following code from this link.
import io
import os
# Imports the Google Cloud client library
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
# Instantiates a client
client = speech.SpeechClient()
# The name of the audio file to transcribe
file_name = os.path.join(
os.path.dirname(__file__),
'resources',
'audio.raw')
# Loads the audio into memory
with io.open(file_name, 'rb') as audio_file:
content = audio_file.read()
audio = types.RecognitionAudio(content=content)
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
sample_rate_hertz=16000,
language_code='en-US')
# Detects speech in the audio file
response = client.recognize(config, audio)
for result in response.results:
print('Transcript: {}'.format(result.alternatives[0].transcript))
However, I am getting the following error when I run it using python 3.4.2 on a raspberry pi.
Traceback (most recent call last):
File "script.py", line 10, in <module>
client = speech.SpeechClient()
File "/usr/local/lib/python3.4/dist- packages/google/cloud/speech_v1/gapic/speech_client.py", line 137, in __init__
credentials=credentials,
File "/usr/local/lib/python3.4/dist-packages/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py", line 76, in __init__
channel)
File "/usr/local/lib/python3.4/dist- packages/google/api_core/operations_v1/operations_client.py", line 59, in __init__
self.operations_stub = operations_pb2.OperationsStub(channel)
AttributeError: 'module' object has no attribute 'OperationsStub'
I have been trying to get over this for about 3 days now and I have not found any solution.
Any help would be appreciated.
python raspberry-pi google-speech-api
python raspberry-pi google-speech-api
asked Nov 15 '18 at 6:35
TheBuffetGuyTheBuffetGuy
61
61
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Not sure if you still have the problem. I went through the same thing this morning.
I, apparently, seemed to have a version of googleapis-common-protos installed which was built without GRPC support (1.6.0b6). I downgraded it to 1.5.3, restarted jupyter server and its working perfectly fine now. Please refer to this link.
Google Cloud Github
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313715%2ferror-in-running-a-script-google-speech-api%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
Not sure if you still have the problem. I went through the same thing this morning.
I, apparently, seemed to have a version of googleapis-common-protos installed which was built without GRPC support (1.6.0b6). I downgraded it to 1.5.3, restarted jupyter server and its working perfectly fine now. Please refer to this link.
Google Cloud Github
add a comment |
Not sure if you still have the problem. I went through the same thing this morning.
I, apparently, seemed to have a version of googleapis-common-protos installed which was built without GRPC support (1.6.0b6). I downgraded it to 1.5.3, restarted jupyter server and its working perfectly fine now. Please refer to this link.
Google Cloud Github
add a comment |
Not sure if you still have the problem. I went through the same thing this morning.
I, apparently, seemed to have a version of googleapis-common-protos installed which was built without GRPC support (1.6.0b6). I downgraded it to 1.5.3, restarted jupyter server and its working perfectly fine now. Please refer to this link.
Google Cloud Github
Not sure if you still have the problem. I went through the same thing this morning.
I, apparently, seemed to have a version of googleapis-common-protos installed which was built without GRPC support (1.6.0b6). I downgraded it to 1.5.3, restarted jupyter server and its working perfectly fine now. Please refer to this link.
Google Cloud Github
answered Dec 20 '18 at 5:53
Mahboob MustafaMahboob Mustafa
105
105
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53313715%2ferror-in-running-a-script-google-speech-api%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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