Issue #1333 open

cpstats tool broken (python3.4)

Anonymous created an issue

I recently switched a project from Python 2.7 to 3.4. Everything seems to be working well with CherryPy, but the cpstats tool is failing when you try to load the stats page.

The following is the error as printed to the error console:

Traceback (most recent call last):
  File "/home/escher/lib/python3.4/cherrypy/_cpwsgi.py", line 234, in __init__
    self.run()
  File "/home/escher/lib/python3.4/cherrypy/_cpwsgi.py", line 337, in run
    request.run(meth, path, qs, rproto, headers, rfile)
  File "/home/escher/lib/python3.4/cherrypy/_cprequest.py", line 589, in run
    self.respond( pi )
  File "/home/escher/lib/python3.4/cherrypy/_cprequest.py", line 647, in respond
    self.namespaces( self.config )
  File "/home/escher/lib/python3.4/cherrypy/lib/reprconf.py", line 117, in __call__
    exit(None, None, None)
  File "/home/escher/lib/python3.4/cherrypy/_cptools.py", line 466, in __exit__
    tool._setup()
  File "/home/escher/lib/python3.4/cherrypy/lib/cpstats.py", line 312, in _setup
    self.record_start()
  File "/home/escher/lib/python3.4/cherrypy/lib/cpstats.py", line 334, in record_start
    'Start Time': time.time(),
AttributeError: 'module' object has no attribute '_get_ident'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/escher/lib/python3.4/cherrypy/_cptree.py", line 144, in release_serving
    req.close()
  File "/home/escher/lib/python3.4/cherrypy/_cprequest.py", line 506, in close
    self.hooks.run( 'on_end_request' )
  File "/home/escher/lib/python3.4/cherrypy/_cprequest.py", line 114, in run
    raise exc
  File "/home/escher/lib/python3.4/cherrypy/_cprequest.py", line 104, in run
    hook()
  File "/home/escher/lib/python3.4/cherrypy/_cprequest.py", line 63, in __call__
    return self.callback( **self.kwargs )
  File "/home/escher/lib/python3.4/cherrypy/lib/cpstats.py", line 342, in record_stop
    w = appstats['Requests'][threading._get_ident()]
AttributeError: 'module' object has no attribute '_get_ident'

Comments (3)

  1. Joel Rivera
    • changed status to open

    This is correct, there are a couple if changes on the threading module for 3.4.

    In particular this is a trivial fix, we just need to drop the _ the new name is: threading.get_ident.

    But for compatibility reasons this will probably require an addition to the _cpcompat module.

  2. Log in to comment