From b067430cd5285e1cadc45acf30c38f0072208558 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 1 Jun 2024 10:47:53 +0200 Subject: [PATCH] Weird fix for a weird error that suddenly started on one of my machines. ``` Traceback (most recent call last): File "/usr/lib/python3.9/dist-packages/platypush/plugins/__init__.py", line 247, in _runner self.main() File "/usr/lib/python3.9/dist-packages/platypush/plugins/bluetooth/__init__.py", line 590, in main self._refresh_cache() File "/usr/lib/python3.9/dist-packages/platypush/plugins/bluetooth/__init__.py", line 146, in _refresh_cache get_entities_engine().wait_start() File "/usr/lib/python3.9/dist-packages/platypush/entities/__init__.py", line 48, in get_entities_engine time_start = time() TypeError: 'module' object is not callable ``` There isn't a single reason in this world for this error to happen. If I do `from time import time`, then `t = time()` is 100% valid Python. I have no clue of what may be causing it, but I hope that this will fix it. --- platypush/entities/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platypush/entities/__init__.py b/platypush/entities/__init__.py index 665ec86ae8..49b8182693 100644 --- a/platypush/entities/__init__.py +++ b/platypush/entities/__init__.py @@ -1,6 +1,6 @@ import logging +import time from threading import Event -from time import time from typing import Collection, Optional from ._base import ( @@ -45,8 +45,8 @@ def get_entities_engine(timeout: Optional[float] = None) -> EntitiesEngine: :param timeout: Timeout in seconds (default: None). """ - time_start = time() - while not timeout or (time() - time_start < timeout): + time_start = time.time() + while not timeout or (time.time() - time_start < timeout): if _engine: break