Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
16054 Visualizações

Hi Team

I understand this function has been removed from python3.8. However i still want to use python 3.8 and get this issue solved. 


Is there anyone who got this error is python 3.8. How this got solved. I am not sure how to install this time.perf_counter()


Error:

Odoo Server Error


Traceback (most recent call last):

  File "/home/odoo/odoo/odoo/http.py", line 624, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/home/odoo/odoo/odoo/http.py", line 310, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/odoo/odoo/odoo/tools/pycompat.py", line 14, in reraise

    raise value

  File "/home/odoo/odoo/odoo/http.py", line 669, in dispatch

    result = self._call_function(**self.params)

  File "/home/odoo/odoo/odoo/http.py", line 350, in _call_function

    return checked_call(self.db, args, *kwargs)

  File "/home/odoo/odoo/odoo/service/model.py", line 94, in wrapper

    return f(dbname, args, *kwargs)

  File "/home/odoo/odoo/odoo/http.py", line 339, in checked_call

    result = self.endpoint(*a, **kw)

  File "/home/odoo/odoo/odoo/http.py", line 915, in _call_

    return self.method(*args, **kw)

  File "/home/odoo/odoo/odoo/http.py", line 515, in response_wrap

    response = f(*args, **kw)

  File "/home/odoo/odoo/addons/web/controllers/main.py", line 1331, in call_button

    action = self._call_kw(model, method, args, kwargs)

  File "/home/odoo/odoo/addons/web/controllers/main.py", line 1319, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/odoo/odoo/odoo/api.py", line 387, in call_kw

    result = _call_kw_multi(method, model, args, kwargs)

  File "/home/odoo/odoo/odoo/api.py", line 374, in _call_kw_multi

    result = method(recs, args, *kwargs)

  File "/home/odoo/odoo/addons/ni_crm_customization/wizard/ni_import_sale_order_line.py", line 49, in ni_action_import_order_lines

    workbook = xlrd.open_workbook(file_contents=file_datas)

  File "/usr/local/lib/python3.8/dist-packages/xlrd/__init__.py", line 153, in open_workbook

    bk = book.open_workbook_xls(

  File "/usr/local/lib/python3.8/dist-packages/xlrd/book.py", line 74, in open_workbook_xls

    t0 = time.clock()

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

Avatar
Cancelar
Melhor resposta

Then replace time.clock with time.time and save it.

Avatar
Cancelar
Melhor resposta

The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)

From https://docs.python.org/3/whatsnew/3.8.html

Avatar
Cancelar