jrjohansson / version_information

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

Handle a non-string __version__ #8

Closed jhykes closed 8 years ago

jhykes commented 9 years ago

Although __version__ is usually a string, there is no standard requiring this. When this extension is used with a package that has a non-string __version__, the HTML table is no longer displayed, and the following warning is given (this was for a float):

.../python2.7/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in text/html formatter: 'float' object has no attribute 'replace'
  FormatterWarning,
.../python2.7/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in text/latex formatter: 'float' object is not iterable
  FormatterWarning,

Adding in a str() call should fix this.