Skip to content

TypeError: 'float' object is not callable #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Ninniachwen opened this issue Sep 20, 2022 · 1 comment
Closed

TypeError: 'float' object is not callable #189

Ninniachwen opened this issue Sep 20, 2022 · 1 comment

Comments

@Ninniachwen
Copy link

Ninniachwen commented Sep 20, 2022

after solving several other errors, I came across this rather generic one and I am at a loss on how to solve it.
I upgraded the SQLAchemy version to 1.4, to avoid AttributeError: module 'time' has no attribute 'clock'
then downgraded a bit again 1.3.24, to avoid the error can't set Variable.

so my recent setup is slightly different from the original
SQLAlchemy==1.3.24
cffi>=1.11.5
Pillow>=5.3.0

also, I changed the config line into
SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db'
to avoid AttributeError: 'NoneType' object has no attribute 'drivername'

However, when I start the app I now get
TypeError: 'float' object is not callable

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 2301, in __call__
return self.wsgi_app(environ, start_response)

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 2287, in wsgi_app
response = self.handle_exception(e)

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 1733, in handle_exception
reraise(exc_type, exc_value, tb)

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\_compat.py", line 35, in reraise
raise value

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 2284, in wsgi_app
response = self.full_dispatch_request()

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 1807, in full_dispatch_request
rv = self.handle_user_exception(e)

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 1710, in handle_user_exception
reraise(exc_type, exc_value, tb)

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\_compat.py", line 35, in reraise
raise value

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 1805, in full_dispatch_request
rv = self.dispatch_request()

File "C:\Python\ToxoData\venv\Lib\site-packages\flask\app.py", line 1791, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)

File "C:\Python\ToxoData\flaskblog\main\routes.py", line 11, in home
posts = Post.query.order_by(Post.date_posted.desc()).paginate(page=page, per_page=5)

File "C:\Python\ToxoData\venv\Lib\site-packages\flask_sqlalchemy\__init__.py", line 491, in paginate
items = self.limit(per_page).offset((page - 1) * per_page).all()

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\orm\query.py", line 3373, in all
return list(self)

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\orm\query.py", line 3535, in __iter__
return self._execute_and_instances(context)

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\orm\query.py", line 3560, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1011, in execute
return meth(self, multiparams, params)

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\sql\elements.py", line 298, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1124, in _execute_clauseelement
ret = self._execute_context(

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1224, in _execute_context
statement, parameters = fn(

File "C:\Python\ToxoData\venv\Lib\site-packages\sqlalchemy\events.py", line 646, in wrap_before_cursor_execute
orig_fn(

File "C:\Python\ToxoData\venv\Lib\site-packages\flask_sqlalchemy\__init__.py", line 252, in before_cursor_execute
context._query_start_time = _timer()

does anyone have any ideas?...

@Ninniachwen
Copy link
Author

if sys.platform == 'win32':
    _timer = time.perf_counter    #this line may not include the () behind perf_counter....
else:
    _timer = time.time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant