简体   繁体   中英

Can Google Cloud Endpoints work with Text To Speech?

I'm trying to keep my Google Cloud project centered around App Engine (GAE) Standard Environment by running a UI in GAE Python 2.7 and then deploying an OpenAPI to Cloud Endpoints which also uses Python 2.7. I want my API to be able to check Google Cloud Storage (GCS) for a file, and then if it doesn't exist, fetch an Entity from Datastore, process some data with Text- to-Speech, and then save resulting mp3 to GCS.

Under Python 2.7, I need to use the old (2015) cloudstorage client library, google-endpoints , google-endpoints-api-management and google-cloud-texttospeech modules, all in my ./lib folder.

With these modules installed, I can run the "echo" demo project without problem. This indicates that there are no dependency version conflicts. However, when trying to use texttospeech , i get this error:

ImportError: No module named grpc._cython.cygrpc

To fix this, I add the following to the libraries section of app.yaml:

- name: grpcio
  version: latest

I then get this error:

from six.moves import http_client 
ImportError: No module named moves

I try to fix it similarly, but the error persists

- name: six
  version: latest

Other solutions didn't help. six 1.12.0 is installed in ./lib, and 1.11.0 comes with the latest gcloud cloud SDK (233.0.0).

How can I use text-to-speech with Cloud Endpoints? Even if i get this working, can I expect it to work with GCS and Datastore? So far, using Flask-RESTful under GAE seems easier.

These client libraries do not work with the first-generation Python 2.7 runtime, and there are no plans to support them.

You will need to use the new second-generation Python 3.7 runtime instead, which will let you install arbitrary dependencies. See " Python 3 Runtime Environment " for more details.

I think the answer is that Google Cloud Client Libraries aren't yet compatible with Google App Engine. The problem I had here persisted when trying to use Text To Speech in a GAE app even though it worked fine when running little tests locally outside of a GAE app.

This issue can be tracked here: https://github.com/googleapis/google-cloud-python/issues/1893

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM