You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting AttributeError in Streaming API client #719
Getting an error when the file is run after setting the environment variable GOOGLE_APPLICATION_CREDENTIALS. I'm using Python 2.7.11 on Windows 8.1.
Stack trace:
C:\test>python transcribe_streaming.py
Traceback (most recent call last):
File "transcribe_streaming.py", line 238, in <module>
main()
File "transcribe_streaming.py", line 214, in main
make_channel('speech.googleapis.com', 443)) as service:
File "transcribe_streaming.py", line 52, in make_channel
creds = credentials.get_credentials().create_scoped([SPEECH_SCOPE])
AttributeError: 'Credentials' object has no attribute 'create_scoped'
Thanks @jonparrott for the direction. I'm trying adding google.auth to the sample myself. Is there any other sample that is up to date with google.auth?
In my attempt at getting google.auth added to transcribe_streaming.py, I modified the code to use google.auth as given in here.
Installed google-cloud-speech-v1 using pip install grpc-google-cloud-speech-v1 before running the file. But getting the following error.
C:\>python transcribe_streaming-new.py
Traceback (most recent call last):
File "transcribe_streaming-new.py", line 256, in <module>
main()
File "transcribe_streaming-new.py", line 231, in main
with cloud_speech.create_Speech_stub(
AttributeError: 'module' object has no attribute 'create_Speech_stub'
When I looked at the attributes of cloud_speech_pb2, I can't see the create_Speech_stub. Instead beta_create_Speech_stub is what it has. I have tried calling this method. I don't know if it is good to use this beta method though.
C:\>python transcribe_streaming-new.py
Traceback (most recent call last):
File "transcribe_streaming-new.py", line 256, in <module>
main()
File "transcribe_streaming-new.py", line 232, in main
make_authorized_channel('speech.googleapis.com', 443)) as service:
File "transcribe_streaming-new.py", line 84, in make_authorized_channel
credentials, host + ':' + str(port), request)
File "D:\Python27\lib\site-packages\google\auth\transport\grpc.py", line 119, in secure_authorized_channel
return grpc.secure_channel(target, composite_credentials, **kwargs)
File "D:\Python27\lib\site-packages\grpc\__init__.py", line 1231, in secure_channel
return _channel.Channel(target, options, credentials._credentials)
File "D:\Python27\lib\site-packages\grpc\_channel.py", line 876, in __init__
_common.encode(target), _options(options), credentials)
File "D:\Python27\lib\site-packages\grpc\_common.py", line 83, in encode
return s.encode('ascii')
AttributeError: 'Request' object has no attribute 'encode'
Exception AttributeError: "'Channel' object has no attribute '_connectivity_state'" in <bound method Channel.__del__ of <grpc._channel.Channel object at 0x0000000003E37898>> ignored
Activity
theacodes commentedon Dec 14, 2016
@chan71 can you give me the output of
pip freeze?chan71 commentedon Dec 14, 2016
Please find the output of
pip greezetheacodes commentedon Dec 15, 2016
Ah I see, this whole sample needs to be updated to use
google.auth.Maybe @jerjou or @ryanmats can handle it?
We should essentially replace
make_channelwith http://google-auth.readthedocs.io/en/latest/reference/google.auth.transport.grpc.html#google.auth.transport.grpc.secure_authorized_channelchan71 commentedon Dec 15, 2016
Thanks @jonparrott for the direction. I'm trying adding google.auth to the sample myself. Is there any other sample that is up to date with google.auth?
theacodes commentedon Dec 15, 2016
chan71 commentedon Dec 15, 2016
In my attempt at getting google.auth added to transcribe_streaming.py, I modified the code to use google.auth as given in here.
Installed google-cloud-speech-v1 using
pip install grpc-google-cloud-speech-v1before running the file. But getting the following error.When I looked at the attributes of cloud_speech_pb2, I can't see the create_Speech_stub. Instead beta_create_Speech_stub is what it has. I have tried calling this method. I don't know if it is good to use this beta method though.
However, I'm getting following error now.
What could be the reason?
theacodes commentedon Dec 15, 2016
@chan71 seems it was a more significant change than anticipated: We have a PR out to fix this here: #724
chan71 commentedon Dec 16, 2016
Works like a charm. Appreciate your fast turnaround in fixing this @jonparrott and team
theacodes commentedon Dec 16, 2016
chore(deps): update dependency google-cloud-bigquery to v3.5.0 (#719)
chore(deps): update dependency google-cloud-bigquery to v3.5.0 (#719)