Sunday, 8 September 2013

Issue running Python sample code for Google Cloud Datastore

Issue running Python sample code for Google Cloud Datastore

GCD and the API client used to work fine for me but now I run into the
following issue when trying the getting started sample code from google
cloud datastore from here:
https://developers.google.com/datastore/docs/getstarted/start_python/
Running the code repeatedly says:
WARNING:oauth2client.util:new_request() takes at most 1 positional
argument (2 given)
And eventually I get a RuntimeError: maximum recursion depth exceeded
while calling a Python object With the following repeated stack trace
repeated:
File "test.py", line 91, in <module>
main()
File "test.py", line 19, in main
resp = datastore.begin_transaction(req)
File
"/usr/local/lib/python2.7/dist-packages/googledatastore/__init__.py",
line 81, in begin_transaction
return get_default_connection().begin_transaction(request)
File
"/usr/local/lib/python2.7/dist-packages/googledatastore/__init__.py",
line 59, in get_default_connection
_options['credentials'] = helper.get_credentials_from_env()
File "/usr/local/lib/python2.7/dist-packages/googledatastore/helper.py",
line 71, in get_credentials_from_env
Credentials. refresh (http)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py",
line 516, in refresh
self._refresh(http.request)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/gce.py", line
82, in _refresh
response, content = http_request(uri)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line
132, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py",
line 475, in new_request
self._refresh(request_orig)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/gce.py", line
82, in _refresh
response, content = http_request(uri)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line
1570, in request
(response, content) = self._request(conn, authority, uri, request_uri,
method, body, headers, redirections, cachekey)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line
1367, in _request
(response, content) = self.request(location, redirect_method,
body=body, headers = headers, redirections = redirections - 1)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line
132, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py",
line 475, in new_request
self._refresh(request_orig)
I installed googledatastore via pip with the following versions installed:
Requirement already satisfied: googledatastore in
/usr/local/lib/python2.6/dist-packages
Requirement already satisfied: protobuf>=2.5.0 in
/usr/local/lib/python2.6/dist-packages/protobuf-2.5.0-py2.6.egg (from
googledatastore)
Requirement already satisfied: oauth2client>=1.1 in
/usr/local/lib/python2.6/dist-packages/oauth2client-1.1-py2.6.egg (from
googledatastore)
Requirement already satisfied: uritemplate>=0.5.2 in
/usr/local/lib/python2.6/dist-packages (from googledatastore)
Requirement already satisfied: setuptools in
/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg (from
protobuf>=2.5.0->googledatastore)
Requirement already satisfied: httplib2>=0.8 in
/usr/local/lib/python2.6/dist-packages/httplib2-0.8-py2.6.egg (from
oauth2client>=1.1->googledatastore)
Requirement already satisfied: python-gflags in
/usr/local/lib/python2.6/dist-packages/python_gflags-2.0-py2.6.egg (from
oauth2client>=1.1->googledatastore)
Requirement already satisfied: simplejson>=2.5.0 in
/usr/local/lib/python2.6/dist-packages (from
uritemplate>=0.5.2->googledatastore)
Installing collected packages: googledatastore, httplib2, oauth2client,
protobuf, python-gflags, setuptools, simplejson, uritemplate
Successfully installed googledatastore
And have tried it with different combinations of oauth2client version 1.2,
with Python2.6 and Python2.7 on Ubuntu Lucid and Ubuntu Precise.

No comments:

Post a Comment