ChatterBot icon indicating copy to clipboard operation
ChatterBot copied to clipboard

error for AttributeError: module 'time' has no attribute 'clock' in chatterbot

Open Adal01672 opened this issue 3 years ago • 5 comments

C:\Users\User\Downloads\TSC>main.py
Traceback (most recent call last):
  File "C:\Users\User\Downloads\TSC\main.py", line 8, in <module>
    chatbot = ChatBot("Ninja")
  File "C:\Python39\lib\site-packages\chatterbot\chatterbot.py", line 41, in __init__
    self.storage = utils.initialize_class(storage_adapter, **kwargs)
  File "C:\Python39\lib\site-packages\chatterbot\utils.py", line 54, in initialize_class
    return Class(*args, **kwargs)
  File "C:\Python39\lib\site-packages\chatterbot\storage\sql_storage.py", line 22, in __init__
    from sqlalchemy import create_engine
  File "C:\Python39\lib\site-packages\sqlalchemy\__init__.py", line 8, in <module>
    from . import util as _util  # noqa
  File "C:\Python39\lib\site-packages\sqlalchemy\util\__init__.py", line 14, in <module>
    from ._collections import coerce_generator_arg  # noqa
  File "C:\Python39\lib\site-packages\sqlalchemy\util\_collections.py", line 16, in <module>
    from .compat import binary_types
  File "C:\Python39\lib\site-packages\sqlalchemy\util\compat.py", line 264, in <module>
    time_func = time.clock
AttributeError: module 'time' has no attribute 'clock'

Adal01672 avatar May 12 '21 15:05 Adal01672

Hey! I think that the clock() function does not exist anymore in the time module, that is the issue here... A quick fix that I did is I went to the file "C:\Python39\lib\site-packages\sqlalchemy\util\compat.py", scrolled down all the way to line 264, and just removed that whole line... worked well enough for me, and I hope it does for you too! 😀

NISH-Original avatar May 30 '21 14:05 NISH-Original

just wondering, can it be that this thing installs an old version of sqlalchemy some how? I mean that thing is still pretty actively maintained and i doupt a bit they would leave a function that is 2 years deprecated in there.

simteraplications avatar Jun 18 '21 22:06 simteraplications

just wondering, can it be that this thing installs an old version of sqlalchemy some how? I mean that thing is still pretty actively maintained and i doupt a bit they would leave a function that is 2 years deprecated in there.

Yeah that's definitely it, this is the requirements.txt.

mathparse>=0.1,<0.2
python-dateutil>=2.8,<2.9
sqlalchemy>=1.3,<1.4
pytz

saahiljaffer avatar Jun 18 '21 22:06 saahiljaffer

Hey! I think that the clock() function does not exist anymore in the time module, that is the issue here... A quick fix that I did is I went to the file "C:\Python39\lib\site-packages\sqlalchemy\util\compat.py", scrolled down all the way to line 264, and just removed that whole line... worked well enough for me, and I hope it does for you too! 😀

Eu arrumei isso colocando "time.time" ao inves de "time.clock" e funcinou mt bem :)

EduardoWS avatar Jul 05 '21 02:07 EduardoWS

Hey! I think that the clock() function does not exist anymore in the time module, that is the issue here... A quick fix that I did is I went to the file "C:\Python39\lib\site-packages\sqlalchemy\util\compat.py", scrolled down all the way to line 264, and just removed that whole line... worked well enough for me, and I hope it does for you too! 😀

Eu arrumei isso colocando "time.time" ao inves de "time.clock" e funcinou mt bem :)

ohh that's rly cool then, didn't quite realise I could do that lol 😅

NISH-Original avatar Jul 09 '21 06:07 NISH-Original