1

The use case is the following:

  1. convert jupyter notebook to python
  2. run converted notebook on-the fly with additional arguments

What I have tried so far:

jupyter nbconvert --to python --stdout .\some_nb.ipynb | python

some_nb.ipynb awaits for arguments via argparse so normally I would do something like:

python some_nb.py --argument_one=1 

When I do that:

jupyter nbconvert --to python --stdout .\some_nb.ipynb | python --argument_one=1

argument_one is of course binded to python and I am not sure how to properly pipeline this.

1 Answer 1

1

Finally got it. Python has - argument after which it reads arguments from stdin

https://docs.python.org/3/using/cmdline.html

jupyter nbconvert --to python --stdout .\some_nb.ipynb| python - --argument_one=1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.