[IPython-dev] Static View for the Notebook

Matthias BUSSONNIER bussonniermatthias at gmail.com
Thu Aug 9 07:12:48 EDT 2012


Le 9 août 2012 à 13:02, Dave Hirschfeld a écrit :

> MinRK <benjaminrk <at> gmail.com> writes:
> 
>> 
>> 
>> When nbconvert is merged into IPython proper, then handlers will be added for 
> nbconvert renderers, which should take care of all of that.
>> 
>> The result would be akin to running `!nbconvert -f html <notebook.ipynb>`, and 
> then visiting files/notebook.html.
>> 
>> 
>> -MinRK
>>  
> 
> Is this supposed to work on windows? I can't get it to work on my Win32 Python 
> 2.7.3. I get the following error:
> 
> 
> C:\dev\code\nbconvert>nbconvert.py -f html staticHTML.ipynb
> Traceback (most recent call last):
>  File "C:\dev\code\nbconvert\nbconvert.py", line 1439, in <module>
>    main(infile=args.infile[0], format=args.format)
>  File "C:\dev\code\nbconvert\nbconvert.py", line 1414, in main
>    htmlfname = converter.render()
>  File "C:\dev\code\nbconvert\nbconvert.py", line 287, in render
>    self.output = self.convert()
>  File "C:\dev\code\nbconvert\nbconvert.py", line 277, in convert
>    converted_cells.append('\n'.join(conv_fn(cell)))
>  File "C:\dev\code\nbconvert\nbconvert.py", line 727, in wrapped
>    rendered = f(self, cell)
>  File "C:\dev\code\nbconvert\nbconvert.py", line 844, in render_markdown
>    p = subprocess.Popen(['markdown'], stdin=subprocess.PIPE, 
> stdout=subprocess.PIPE)
>  File "C:\dev\bin\Python27\lib\subprocess.py", line 679, in __init__
>    errread, errwrite)
>  File "C:\dev\bin\Python27\lib\subprocess.py", line 893, in _execute_child
>    startupinfo)
> WindowsError: [Error 2] The system cannot find the file specified
> 
> After installing ActivePerl, putting Markdown.pl in the nbconvert directory
> and changing line 844 to
> 
>  p = subprocess.Popen(['markdown.pl'], ...
> 
> I then get a different error:

Instead of using popen you can use the markdown python package that is pip installable. 
I did it for nbviewer that yon can find on github and need to bring the changes to nbconvert.
notebook convert still need some work.

import markdown
….
843     @DocInherit$
844     @text_cell$
845     def render_markdown(self, cell):$
846         return [markdown.markdown(cell.source)] $

just need to replace i everywhere

if someone have time to do it and test….
-- 
Matthias



> 
> Traceback (most recent call last):
>  File "C:\dev\code\nbconvert\nbconvert.py", line 1439, in <module>
>    main(infile=args.infile[0], format=args.format)
>  File "C:\dev\code\nbconvert\nbconvert.py", line 1414, in main
>    htmlfname = converter.render()
>  File "C:\dev\code\nbconvert\nbconvert.py", line 287, in render
>    self.output = self.convert()
>  File "C:\dev\code\nbconvert\nbconvert.py", line 277, in convert
>    converted_cells.append('\n'.join(conv_fn(cell)))
>  File "C:\dev\code\nbconvert\nbconvert.py", line 727, in wrapped
>    rendered = f(self, cell)
>  File "C:\dev\code\nbconvert\nbconvert.py", line 844, in render_markdown
>    p = subprocess.Popen(['markdown.pl'], stdin=subprocess.PIPE, 
> stdout=subprocess.PIPE)
>  File "C:\dev\bin\Python27\lib\subprocess.py", line 679, in __init__
>    errread, errwrite)
>  File "C:\dev\bin\Python27\lib\subprocess.py", line 893, in _execute_child
>    startupinfo)
> WindowsError: [Error 193] %1 is not a valid Win32 application
> 
> 
> -Dave
> 
> 
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list