jrjohansson / version_information

IPython magic command for showing version information for dependency modules in a notebook.
54 stars 17 forks source link

version_information not compatible with python 3.8 (cgi.escape) #15

Open wjcapehart opened 4 years ago

wjcapehart commented 4 years ago

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

pamag commented 4 years ago

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

leebrian commented 3 years ago

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