TypeError: 'exceptions.ValueError' object is not callable, when using client.service.create()
See original GitHub issueCall to client.service.create() fails without understandable error with the following trace:
e = HTTPError(u'500 Server Error: Internal Server Error for url: http+docker://localunixsocket/v1.32/services/create',)
def create_api_error_from_http_exception(e):
"""
Create a suitable APIError from requests.exceptions.HTTPError.
"""
response = e.response
try:
explanation = response.json()['message']
except ValueError:
explanation = response.content.strip()
cls = APIError
if response.status_code == 404:
if explanation and ('No such image' in str(explanation) or
'not found: does not exist or no pull access'
in str(explanation) or
'repository does not exist' in str(explanation)):
cls = ImageNotFound
else:
cls = NotFound
> raise cls(e, response=response, explanation=explanation)
E TypeError: 'exceptions.ValueError' object is not callable
Notes: client object has been created using version=“1.32” but same result with version=‘auto’ or without version
Info:
docker==2.6.1
docker-pycreds==0.2.1
Python 2.7.13
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: darwin/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Python TypeError: Object is Not Callable. Why This Error?
The TypeError'str' object is not callable occurs when you access a string by using parentheses. Parentheses are only applicable to callable ...
Read more >What does "TypeError 'xxx' object is not callable" means?
The action occurs when you attempt to call an object which is not a function, as with () .
Read more >TypeError: object is not callable in Python | bobbyhadz
The Python "TypeError: object is not callable" occurs when we try to call a not-callable object (e.g. a list or dict) as a...
Read more >TypeError 'module' object is not callable in Python - STechies
This error statement TypeError: 'module' object is not callable occurs when the user gets confused between Class name and Module name. The issue...
Read more >What is "typeerror: 'module' object is not callable"
This error statement TypeError: 'module' object is not callable is raised as you are being confused about the Class name and Module name....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@feliperuhland sorry for the delay, from the python console all is working as expected:
So it seems not a library bug 👍 Using the lib wrapped around Flask is working too. I’m investigating further… the problem is limited to pytest + Flask test_client:
returns the well known
E TypeError: 'exceptions.ValueError' object is not callable
Seems the library docker/errors.py:22
cls = APIError
can’t found the correct APIError class when using pytest + Flask test_client()
Thanks again for your support!
@shin- I think we can close this.