lundi 25 juin 2018

TypeError: 'method' object is not iterable in python3.6 flask framework

Hi i'm a student and learning python :) currently i was practicing flask for web api's . when ever i post request for form data using "postman". i got the following exception i have searched for possiblities for TypeError but those could not help me

  • Running on http://127.0.0.1:5959/ (Press CTRL+C to quit)
  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 241-358-774 127.0.0.1 - - [25/Jun/2018 18:06:38] "POST /users/register HTTP/1.1" 500 - Traceback (most recent call last): File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 2309, in call return self.wsgi_app(environ, start_response) File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app response = self.handle_exception(e) File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/bin/python3./lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/bin/python3./lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/bin/python3./lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functionsrule.endpoint File "/root/Desktop/python_practice_price_alert/src/models/users/views.py", line 35, in register_user if User.register_user(email, password): File "/root/Desktop/python_practice_price_alert/src/models/users/user.py", line 49, in register_user User(email, Utils.hashed_password(password)).save_to_db() File "/root/Desktop/python_practice_price_alert/src/models/users/user.py", line 63, in save_to_db Database.insert("users", self.json) File "/root/Desktop/python_practice_price_alert/src/common/database.py", line 15, in insert Database.DATABASE[collection].insert(data) File "/usr/bin/python3./lib/python3.6/site-packages/pymongo/collection.py", line 2941, in insert check_keys, manipulate, write_concern) File "/usr/bin/python3./lib/python3.6/site-packages/pymongo/collection.py", line 631, in _insert blk.ops = [(message._INSERT, doc) for doc in gen()] File "/usr/bin/python3./lib/python3.6/site-packages/pymongo/collection.py", line 631, in blk.ops = [(message._INSERT, doc) for doc in gen()] File "/usr/bin/python3./lib/python3.6/site-packages/pymongo/collection.py", line 609, in gen for doc in docs: TypeError: 'method' object is not iterable



Aucun commentaire:

Enregistrer un commentaire