Closed Makeem49 closed 3 years ago
The error message that you provided is incomplete. Please indicate the complete error, including stack trace and any other information printed to the console.
Traceback (most recent call last): File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask\app.py", line 2464, in call return self.wsgi_app(environ, start_response) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask\app.py", line 2458, in wsgi_app ctx.auto_pop(error) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask\ctx.py", line 452, in auto_pop self.pop(exc) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask\ctx.py", line 438, in pop app_ctx.pop(exc) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask\ctx.py", line 238, in pop self.app.do_teardown_appcontext(exc) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask\app.py", line 2321, in do_teardown_appcontext func(exc) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\flask_sqlalchemy__init__.py", line 858, in shutdown_session self.session.commit() File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\scoping.py", line 163, in do return getattr(self.registry(), name)(*args, **kwargs) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\session.py", line 1046, in commit self.transaction.commit() File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\session.py", line 504, in commit self._prepare_impl() File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\session.py", line 483, in _prepare_impl self.session.flush() File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\session.py", line 2540, in flush self._flush(objects) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\session.py", line 2682, in _flush transaction.rollback(_capture_exception=True) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\util\langhelpers.py", line 70, in exit with_traceback=exctb, File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\util\compat.py", line 182, in raise raise exception File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\session.py", line 2642, in _flush flush_context.execute() File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 422, in execute rec.execute(self) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 589, in execute uow, File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\persistence.py", line 236, in save_obj update, File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\orm\persistence.py", line 995, in _emit_update_statements statement, multiparams File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\engine\base.py", line 1011, in execute return meth(self, multiparams, params) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\sql\elements.py", line 298, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\engine\base.py", line 1130, in _execute_clauseelement distilled_params, File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\engine\base.py", line 1317, in _execute_context e, statement, parameters, cursor, context File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\engine\base.py", line 1511, in _handle_dbapi_exception sqlalchemy_exception, with_traceback=excinfo[2], from=e File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\util\compat.py", line 182, in raise_ raise exception File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\engine\base.py", line 1277, in _execute_context cursor, statement, parameters, context File "C:\Users\Makeem\Desktop\snake-app-restructuring\env\lib\site-packages\sqlalchemy\engine\default.py", line 608, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'builtin_function_or_method' [SQL: UPDATE users SET sign_in_count=%(sign_in_count)s, current_sign_in_on=%(current_sign_in_on)s, current_sign_in_ip=%(current_sign_in_ip)s WHERE users.id = %(users_id)s] [parameters: {'sign_in_count': 1, 'current_sign_in_on': <built-in method utcnow of type object at 0x00007FFCBE9FD6C0>, 'current_sign_in_ip': '127.0.0.1', 'users_id': 4}] (Background on this error at: http://sqlalche.me/e/13/f405) 127.0.0.1 - - [21/Feb/2021 09:42:32] "POST /login HTTP/1.1" 200 - 127.0.0.1 - - [21/Feb/2021 09:48:58] "POST /login HTTP/1.1" 500 -
I think this line:
self.current_sign_in_on = datetime.datetime.utcnow
should be:
self.current_sign_in_on = datetime.datetime.utcnow()
Thanks Miguel, it worked.
On Sun, Feb 21, 2021 at 10:59 AM Miguel Grinberg notifications@github.com wrote:
I think this line:
self.current_sign_in_on = datetime.datetime.utcnow
should be:
self.current_sign_in_on = datetime.datetime.utcnow()
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/miguelgrinberg/flasky/issues/502#issuecomment-782880347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOHHQSM7D32VHGKFZI6AXWDTAEUV5ANCNFSM4X7B6PZQ .
Hello Miguel, Thanks for your contribution in my programming career. I'm having problem with my app i'm currently building though it's a clone application. So, whenever i tried to add a new user i usually get this error : psycopg2.ProgrammingError: can't adapt type 'builtin_function_or_method' . Below is my model code and config for database url
confi.py
Model.py