TypeError: int() argument must be a string, a bytes-like object or a number, not 'InstrumentedAttribute'
See original GitHub issueUsing the Swagger interface i’m trying to make a PUT request. This triggers the update but i get an error in the response and in the console where i’m running the server.
Response error:
{
"message": "Internal Server Error"
}
I’m using Flask_api_example, the tests all pass fine but making a PUT request in the swagger interface (127.0.0.1:5000) triggers this error. The entry gets updated just fine, couldn’t find the issue in my implementation so i think it can be related to flask_accepts.
127.0.0.1 - - [12/Nov/2019 20:22:47] "GET /api/barbota/ranks/ HTTP/1.1" 200 -
[2019-11-12 20:22:57,833] ERROR in app: Exception on /api/barbota/ranks/1 [PUT]
Traceback (most recent call last):
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask_restplus/api.py", line 325, in wrapper
resp = resource(*args, **kwargs)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask_restplus/resource.py", line 44, in dispatch_request
resp = meth(*args, **kwargs)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask_accepts/decorators/decorators.py", line 100, in inner
return func(*args, **kwargs)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/flask_accepts/decorators/decorators.py", line 186, in inner
serialized = schema.dump(rv)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/marshmallow/schema.py", line 553, in dump
result = self._serialize(processed_obj, many=many)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/marshmallow/schema.py", line 517, in _serialize
value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/marshmallow/fields.py", line 325, in serialize
return self._serialize(value, attr, obj, **kwargs)
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/marshmallow/fields.py", line 899, in _serialize
ret = self._format_num(value) # type: _T
File "/home/bledy/projects/barbota-api/.venv/lib/python3.7/site-packages/marshmallow/fields.py", line 874, in _format_num
return self.num_type(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'InstrumentedAttribute'
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
TypeError: int() argument must be a string, a bytes-like object ...
int() argument must be a string, a bytes-like object, or a number, not 'NoneType'. According to the error, you can't convert strings type ......
Read more >What does 'int() argument must be a string, a bytes like object ...
The error "int() argument must be a string, a bytes like object or a number, not 'NoneType'. Error saving date" means that the...
Read more >[Solved] TypeError: int() argument must be a string, a bytes ...
How To Solve TypeError: int() argument must be a string, a bytes-like object or a number, not 'list' Error ? Solution 1: convert...
Read more >int() argument must be a string, a bytes-like object or a number ...
Django : TypeError : int () argument must be a string, a bytes - like object or a number, not 'list' [ Beautify...
Read more >TypeError: Int() argument must be a string, a byte-like object or ...
50 date = int(date) 51 row[6] = date 52 TypeError: int() argument must be a string, a bytes-like object or a number, not...
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 Free
Top 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
Not a problem, glad you got it resolved!
Hey, i was able to figure out the issue, it was my mistake. I was returning
Ranks
instead ofranks
inservice.py
…So sorry for wasting your time and thanks.