These are chat archives for cherrypy/cherrypy
CherryPy is a pythonic, object-oriented HTTP framework. | post your issues to: github.com/cherrypy/cherrypy/issues | FAQ: https://stackoverflow.com/questions/tagged/cheroot+or+cherrypy
hi everyone. I'm looking into the covercp stuff, as described here: http://docs.cherrypy.org/en/latest/pkg/cherrypy.lib.html#module-cherrypy.lib.covercp
it's not working, when I try to call
serve() as described I get:
cherrypy/lib/covercp.py", line 377, in serve if coverage is None: UnboundLocalError: local variable 'coverage' referenced before assignment
The relevant source snippit is this:
def serve(path=localFile, port=8080, root=None): if coverage is None: raise ImportError('The coverage module could not be imported.') from coverage import coverage cov = coverage(data_file=path) cov.load()
it seems to me like the
from coverage import coverage should come before
if converage is None. but perhaps not -- am I missing something about how this should work?
@schamp Hi, it's an ancient code nobody looked at for decade, so it's probably outdated. PRs are welcome anyway :)
From code I see that there's a try/except importing required module at the top. Also, the docstring there explains that there should be additional requirement from 2001 found and downloaded.
So it's a good field for refactoring/improvements.