Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2@file
3@brief Calls :epkg:`nbconvert` in command line for latex and pdf.
4"""
5import sys
6import warnings
8try:
9 from nbconvert.nbconvertapp import main as nbconvert_main
10except AttributeError as e:
11 raise ImportError("Unable to import nbconvert") from e
14def run_nbconvert(argv):
15 try:
16 nbconvert_main(argv=argv)
17 except Exception as ee:
18 warnings.warn(
19 "[run_nbconvert-ERROR] Unable to to convert a notebook with "
20 "args=%r due to %r." % (argv, ee), RuntimeWarning)
23def main():
24 run_nbconvert(sys.argv[1:])
27if __name__ == "__main__":
28 main()