Yes, this is exactly what I am looking for. Thank you for your detailed 
reply!!! This is all very helpful.



On Monday, August 21, 2017 at 11:45:33 PM UTC-7, Min RK wrote:
>
> I suspect what you want is a post-save hook 
> <http://jupyter-notebook.readthedocs.io/en/latest/extending/savehooks.html> 
> that calls nbconvert. For example:
>
> import iofrom nbcovert import export, HTMLExporter
> def script_post_save(model, os_path, contents_manager, **kwargs):
>     """convert notebooks to HTML after save with nbconvert"""
>
>     if model['type'] != 'notebook':
>         return
>
>     global _exporter
>
>     if _exporter is None:
>         _exporter = HTMLExporter(parent=contents_manager)
>
>     base, ext = os.path.splitext(os_path)
>     # your rename logic goes here
>     html_fname = base + '.html'
>     html, resources = _exporter.from_filename(os_path)
>
>     with io.open(html_fname, 'w', encoding='utf-8') as f:
>         f.write(html)
>
> c.FileContentsManager.post_save_hook = script_post_save
>
> -Min
> ​
>
> On Mon, Aug 21, 2017 at 10:14 PM, Mayeshh <[email protected] 
> <javascript:>> wrote:
>
>> Hello,
>>
>> I am very new to python, and I am currently using Jupyter notebooks to 
>> analyze microscopy data. I have looked into using `nbconvert` as a library, 
>> however, I have to run these particular notebooks manually (centering 
>> images, choose files through globing, etc.). For this reason, I don't want 
>> to implement `nbconvert` from the command line. 
>>
>> My not-solution has been to use the Jupyter notebook GUI to save the 
>> output as HTML (required for record keeping) and update the name manually. 
>> This is problematic because I can easily forget to save the notebook or 
>> name it incorrectly. I am also trying to speed up my workflow, and I have 
>> identified this step as a bottleneck...
>>
>> How can I automate this action within the notebook? Will it require 
>> JavaScript? If so, I lack any knowledge of JavaScript... Can anyone offer a 
>> solution to this use-case? Any advice is greatly appreciated! 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Project Jupyter" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jupyter/487c5080-c4cc-45a2-90f1-7b5066f663e6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/487c5080-c4cc-45a2-90f1-7b5066f663e6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/01b97f63-f4aa-447e-831d-a8974be6e11c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to