question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'time' has no attribute 'clock'

See original GitHub issue

Code Source:

`from chatterbot import ChatBot chatbot = ChatBot( ‘EjemploBot’, trainer=‘chatterbot.trainers.ChatterBotCorpusTrainer’ )

chatbot.train(“chatterbot.corpus.spanish”)

while True: usuario = input(">>> ") respuesta = chatbot.get_response(usuario) print ("bot: "+str(respuesta))

`

ERROR:

C:\00-Documentos\01-Proyectos\01-Proyectos Python\01-Chatbot>python pract_chatterbox_v2.py Traceback (most recent call last): File “pract_chatterbox_v2.py”, line 5, in <module> chatbot = ChatBot( File “C:\Python38-64\lib\site-packages\chatterbot\chatterbot.py”, line 35, in init self.storage = utils.initialize_class(storage_adapter, **kwargs) File “C:\Python38-64\lib\site-packages\chatterbot\utils.py”, line 54, in initialize_class return Class(*args, **kwargs) File “C:\Python38-64\lib\site-packages\chatterbot\storage\sql_storage.py”, line 22, in init from sqlalchemy import create_engine File “C:\Python38-64\lib\site-packages\sqlalchemy_init_.py”, line 8, in <module> from . import util as util # noqa File "C:\Python38-64\lib\site-packages\sqlalchemy\util_init.py", line 14, in <module> from ._collections import coerce_generator_arg # noqa File “C:\Python38-64\lib\site-packages\sqlalchemy\util_collections.py”, line 16, in <module> from .compat import binary_types File “C:\Python38-64\lib\site-packages\sqlalchemy\util\compat.py”, line 264, in <module> time_func = time.clock AttributeError: module ‘time’ has no attribute ‘clock’

``

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Priyam1418commented, Jun 1, 2020

I’m also facing the same problem and hope to see updates soon but think the solution: if win32 or jython: try: # Python 3.4+ preferred_clock = time.perf_counter except AttributeError: # Earlier than Python 3. preferred_clock = time.clock else: time_func = time.time

is working properly!!

0reactions
GuhOlivcommented, Dec 19, 2022

me too.

i think that the problem is this control:

if win32 or jython: time_func = time.clock else: time_func = time.time

file compat.py (SQLAlchemy library). the control is not correct. it may be:

if win32 or jython: try: # Python 3.4+ preferred_clock = time.perf_counter except AttributeError: # Earlier than Python 3. preferred_clock = time.clock else: time_func = time.time

like sessions.py (requests library)

(sorry for bad indentations, but i don’t know how to indent in comment…)

Thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: module 'time' has no attribute 'clock' in Python 3.8
Go to your error last line and go to that directory and open that particular file. search time.clock using ctrl+f and replace it...
Read more >
AttributeError module 'time' has no attribute 'clock' | bobbyhadz
The Python "AttributeError module 'time' has no attribute 'clock'" occurs because since Python v3.8, the clock() function has been removed.
Read more >
Attributeerror: module time has no attribute clock ( Solved )
Attributeerror : module time has no attribute clock occurs because of time.clock function is now deprecated in python 3.8 or later versions.
Read more >
AttributeError module 'time' has no attribute 'clock' - Python GUIs
AttributeError module 'time' has no attribute 'clock ' Using PyQtGraph with Python 3.8 ... PyQtGraph is a library for creating plots in PyQt ......
Read more >
AttributeError: module 'time' has no attribute 'clock' - Odoo
The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found