Skip to content

Implement better error handling of the case when the Chrome is not yet installed on Linux #58

@stanislaw

Description

@stanislaw

The only error message should be about the missing browser, but running the test-fuzz also produces a non-existing path error.

Traceback (most recent call last):
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc.py", line 620, in <module>
    main()
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc.py", line 568, in main
    driver: webdriver.Chrome = create_webdriver(
                               ^^^^^^^^^^^^^^^^^
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc.py", line 398, in create_webdriver
    path_to_chrome_driver = ChromeDriverManager().get_chrome_driver(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc.py", line 96, in get_chrome_driver
    raise RuntimeError(
RuntimeError: html2pdf4doc: Web Driver Manager could not detect an existing Chrome installation.
Command '['/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/.venv/bin/python', '/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc.py', 'print', '--strict', 'tests/fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html.mut.html', 'tests/fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html.mut.html.pdf']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc_fuzzer.py", line 130, in mutate_and_print
    _: CompletedProcess[bytes] = run(
                                 ^^^^
  File "/usr/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/.venv/bin/python', '/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc.py', 'print', '--strict', 'tests/fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html.mut.html', 'tests/fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html.mut.html.pdf']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc_fuzzer.py", line 193, in <module>
    main()
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc_fuzzer.py", line 173, in main
    success = mutate_and_print(path_to_input_file, path_to_root)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc_fuzzer.py", line 138, in mutate_and_print
    copy_mutated_file()
  File "/home/stanislav/workspace/strictdoc-project/html2pdf4doc_python/html2pdf4doc/html2pdf4doc_fuzzer.py", line 118, in copy_mutated_file
    shutil.copy(path_to_mut_pdf, path_to_mut_pdf_out)
  File "/usr/lib/python3.12/shutil.py", line 435, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.12/shutil.py", line 260, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'tests/fuzz/01_strictdoc_guide_202510/strictdoc/docs/strictdoc_01_user_guide-PDF.html.mut.html.pdf'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions