Coverage for pyquickhelper/helpgen/process_notebooks_cmd.py: 50%
16 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
1"""
2@file
3@brief Calls :epkg:`nbconvert` in command line for latex and pdf.
4"""
5import sys
6import warnings
7import traceback
9try:
10 from nbconvert.nbconvertapp import main as nbconvert_main
11except AttributeError as e:
12 raise ImportError("Unable to import nbconvert") from e
15def run_nbconvert(argv):
16 try:
17 nbconvert_main(argv=argv)
18 except Exception as ee:
19 warnings.warn(
20 "[run_nbconvert-ERROR] Unable to convert a notebook with "
21 "args=%r due to %r\n--CALL-STACK--\n%s." % (
22 argv, ee, traceback.format_exc()), RuntimeWarning)
25def main():
26 run_nbconvert(sys.argv[1:])
29if __name__ == "__main__":
30 main()