Skip to content

Suggestion: --sync as default when script is older than notebook #254

Closed
@GeeCastro

Description

After building a notebook from python script:

jupytext --to notebook script.py # produces script.ipynb
jupyter nbconvert --execute --to notebook --inplace script.ipynb # runs the notebook

the notebook is not usable in jupyter. Error from jupytext extension:

Error loading notebook
script.ipynb (last modified *blabla*) seems more recent than script.py (last modified *blabla*) 
Please either: 
    - open script.py in a text editor, make sure it is up to date, and save it, 
    - or delete script.py if not up to date, 
    - or increase check margin by adding, say, c.ContentsManager.outdated_text_notebook_margin = 5 # in seconds # or float("inf") to your .jupyter/jupyter_notebook_config.py file 

This error is clearly understandable (thanks!). However it happens only if the notebook is more recent than the python script. If the notebook is older (the otherway around), it is synced to the python script.
So it's necessary to do what's advised in the error or (my pref):

jupytext --sync script.ipynb

Wouldn't it be better to have the same behavior in both ways ? If not I'd be interested to learn why :-).
Thank you for this tool !!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions