version_information icon indicating copy to clipboard operation
version_information copied to clipboard

version_information not compatible with python 3.8 (cgi.escape)

Open wjcapehart opened this issue 4 years ago • 2 comments

Hello Robert:

I have run into a problem with your version_information resource when moving to Python 3.8 under JupyterLab 2.1.2 (it's not giving the error when working in a simple IPython terminal window).

The error seems to be related to cgi.escape no longer being used in Python 3.8 https://github.com/Supervisor/supervisor/issues/1257

Example of error is here:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python3.8/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

/usr/local/Cellar/jupyterlab/2.1.2/libexec/lib/python3.8/site-packages/version_information/version_information.py in _repr_html_(self)
    126         html += "<tr><th>Software</th><th>Version</th></tr>"
    127         for name, version in self.packages:
--> 128             _version = cgi.escape(version)
    129             html += "<tr><td>%s</td><td>%s</td></tr>" % (name, _version)
    130 

AttributeError: module 'cgi' has no attribute 'escape'

Regards, Bill Capehart SD Mines

wjcapehart avatar May 21 '20 18:05 wjcapehart

cgi.escape is deprecated since Python version 3.2: This function is unsafe because quote is false by default, and therefore deprecated. html.escape() should be use instead.

This function has been removed in Python 3.8

pamag avatar Jun 15 '20 18:06 pamag

This should now be resolved with PR #19 . Would you please give it a test and let me know?

leebrian avatar Aug 19 '21 20:08 leebrian