This question must've been asked before, but I couldn't find a right answer. I would like to run the Jupyter notebook from command line and save the result to certain files.
I got this running,
jupyter nbconvert --to python --execute mynotebook.ipynb >> mylog.out.log 2>&1
This command executes mynotebook.ipynb properly, but in the log file, it only contains 3 lines if the execution is successful.
[NbConvertApp] Converting notebook mynotebook.ipynb to python
[NbConvertApp] Executing notebook with kernel: python2
[NbConvertApp] Writing 1931 bytes to mynotebook.ipynb.py
If the notebook raises some exception, it will show the exception in the log file too. But where do I see the results of the notebook?
For example, in my notebook, I have
print 'hello world'
This output doesn't show in my command line interface or in the log file. Is there an approach or a parameter setting to keep the output into a log file? I would like to see the detailed results of mynotebook.ipynb.
Any thought? or any other better method than jupyter nbconvert?
Also, it that possiable to include the datetime into the log file? it would be very helpful to have the time included.
You can try --stdout and you have to convert to something like html to see output for example
jupyter nbconvert --to html mynotebook.ipynb --stdout --ExecutePreprocessor.kernel_name=python --ExecutePreprocessor.enabled=True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With