Google-cloud-python: Storage: TypeError in `storage.Client()`

Created on 29 Aug 2019  路  2Comments  路  Source: googleapis/google-cloud-python

Hello.
I have been confronted with `TypeError' in trying 'storage.Client()' on Google App Engine (Python3.7 standard environment).

The cord was like this:

import flask
from google.cloud import storage
app = flask.Flask(__name__)

@app.route('/storage_test', method = ['POST'])
def storage_test():
    client = storage.Client()

I pushed this app with gcloud app deploy command, and send post request to the proper URL.
Then, I faced the following error:

TypeError: __init__() takes 2 positional arguments but 3 were given
at __init__ (/env/lib/python3.7/site-packages/google/cloud/storage/_http.py:35)
at __init__ (/env/lib/python3.7/site-packages/google/cloud/storage/client.py:110)
at storage_test (/srv/main.py:7)

Though I tried to downgrade to google-cloud-storage==1.18.0, it didn't work either.

I would appreciate it if you give us some reply.

question storage packaging

Most helpful comment

You have an out-of-date version of google-cloud-core installed somehow. google-cloud-storage 1.19.0 requires google-cloud-core >= 1.0.3, while google-cloud-storage 1.18.0 requires google-cloud-core >= 1.0.0.

The Python3 AppEngine docs recommend using pip freeze in your local virtual environment to generate requirements.txt, which suggests to me that the installation process doesn't actually resolve dependencies.

All 2 comments

My requirements.txt is like this:

Flask==1.1.1
Werkzeug==0.15.5
google-cloud-storage==1.19.0

You have an out-of-date version of google-cloud-core installed somehow. google-cloud-storage 1.19.0 requires google-cloud-core >= 1.0.3, while google-cloud-storage 1.18.0 requires google-cloud-core >= 1.0.0.

The Python3 AppEngine docs recommend using pip freeze in your local virtual environment to generate requirements.txt, which suggests to me that the installation process doesn't actually resolve dependencies.

Was this page helpful?
0 / 5 - 0 ratings