diff --git a/src/ert/shared/_doc_utils/ert_jobs.py b/src/ert/shared/_doc_utils/ert_jobs.py index efff2b7096b..37bd37c5fc5 100644 --- a/src/ert/shared/_doc_utils/ert_jobs.py +++ b/src/ert/shared/_doc_utils/ert_jobs.py @@ -21,7 +21,7 @@ def __init__( category: str, job_source: str, description: str, - job_config_file: str, + job_config_file: Optional[str], parser: Optional[Callable[[], ArgumentParser]], examples: Optional[str] = "", ) -> None: @@ -38,10 +38,12 @@ def _create_job_config_section(self) -> nodes.section: section_id=self.name + "-job-config", title="Job configuration used by ERT" ) - with open(self.job_config_file, encoding="utf-8") as fh: - job_config_text = fh.read() - job_config_text_node = nodes.literal_block(text=job_config_text) - config_section_node.append(job_config_text_node) + if self.job_config_file: + with open(self.job_config_file, encoding="utf-8") as fh: + job_config_text = fh.read() + job_config_text_node = nodes.literal_block(text=job_config_text) + config_section_node.append(job_config_text_node) + return config_section_node def _create_job_details(self) -> nodes.definition_list: