This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Quast 5.0.2 Problem

Hi everyone,

I'm trying to run quast with python ./setup.py test to verify installation. And then it shows this error.

module 'cgi' has no attribute 'escape'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/EGG-INFO/scripts/quast.py", line 307, in <module>
    return_code = main(sys.argv[1:])
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/EGG-INFO/scripts/quast.py", line 148, in main
    from quast_libs import basic_stats
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/quast_libs/basic_stats.py", line 15, in <module>
    from quast_libs.circos import set_window_size
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/quast_libs/circos.py", line 25, in <module>
    from quast_libs.icarus_utils import get_assemblies, check_misassembled_blocks, Alignment
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/quast_libs/icarus_utils.py", line 15, in <module>
    from quast_libs.html_saver.html_saver import trim_ref_name
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/quast_libs/html_saver/html_saver.py", line 18, in <module>
    from quast_libs.site_packages.jsontemplate import jsontemplate
  File "/usr/local/lib/python3.8/dist-packages/quast-5.0.2-py3.8.egg/quast_libs/site_packages/jsontemplate/jsontemplate.py", line 583, in <module>
    'html': cgi.escape,
AttributeError: module 'cgi' has no attribute 'escape'
ERROR! exception caught!
assembly quast qc

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

1 answer

If you open up the file jsontemplate.py, that is where the error is occurring:

You will first need to 'import html' somewhere near the beginning of the script, preferably where the other modules are imported. Then at line 583, replace "cgi.escape" to "html.escape"

Log in to answer this question.