[IPython-dev] status of nbconvert

Zoltán Vörös zvoros at gmail.com
Mon Jan 19 06:26:00 EST 2015


Hi all,

I have recently had problems with nbconvert, and I was wondering, 
whether I do something improper, or the code is really broken. I have 
pulled the latest from master, and nbconvert fails outright with a 
simple notebook. (This eventually leads to a 500 server error, whenever 
I try to download a notebook.)

Here is my traceback:

ipython nbconvert test.ipynb
Traceback (most recent call last):
   File "/usr/local/bin/ipython", line 5, in <module>
     start_ipython()
   File "/usr/local/lib/python2.7/dist-packages/IPython/__init__.py", 
line 120, in start_ipython
     return launch_new_instance(argv=argv, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 573, in launch_instance
     app.initialize(argv)
   File "<string>", line 2, in initialize
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 75, in catch_config_error
     return method(app, *args, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 
321, in initialize
     super(TerminalIPythonApp, self).initialize(argv)
   File "<string>", line 2, in initialize
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 75, in catch_config_error
     return method(app, *args, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/core/application.py", 
line 369, in initialize
     self.parse_command_line(argv)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/terminal/ipapp.py", line 
316, in parse_command_line
     return super(TerminalIPythonApp, self).parse_command_line(argv)
   File "<string>", line 2, in parse_command_line
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 75, in catch_config_error
     return method(app, *args, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 471, in parse_command_line
     return self.initialize_subcommand(subc, subargv)
   File "<string>", line 2, in initialize_subcommand
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 75, in catch_config_error
     return method(app, *args, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/config/application.py", 
line 402, in initialize_subcommand
     subapp = import_item(subapp)
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/utils/importstring.py", 
line 42, in import_item
     module = __import__(package, fromlist=[obj])
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/__init__.py", 
line 3, in <module>
     from .exporters import *
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/__init__.py", 
line 1, in <module>
     from .export import *
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/export.py", 
line 13, in <module>
     from .templateexporter import TemplateExporter
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/exporters/templateexporter.py", 
line 30, in <module>
     from IPython.nbconvert import filters
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/filters/__init__.py", 
line 6, in <module>
     from .markdown import *
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/filters/markdown.py", 
line 79, in <module>
     class MathBlockLexer(mistune.BlockLexer):
   File 
"/usr/local/lib/python2.7/dist-packages/IPython/nbconvert/filters/markdown.py", 
line 80, in MathBlockLexer
     default_rules = ['block_math', 'latex_environment'] + 
mistune.BlockLexer.default_rules
AttributeError: type object 'BlockLexer' has no attribute 'default_rules'



If, in markdown.py, I remove

+ mistune.BlockLexer.default_rules on line 80, and
+ mistune.InlineLexer.default_rules on line 108, then everything seems 
to work fine.

Could it be that the mistune version that I have (0.4) doesn't have the 
default_rules property, but the version with which ipython was tested on 
travis has? If so, shouldn't nbconvert bail out when the version 
requirement is not fulfilled, or shouldn't simply the default_rules 
property be defined, when the class is inherited in markdown.py? If this 
is the case, I could file a fix on github.

Somewhat related: if there is a server error, wouldn't it be more 
meaningful to return the traceback, instead of "500: internal server error"?

Cheers,
Zoltán





More information about the IPython-dev mailing list