{"record":{"id":"9236f8799c0676e6","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"il-file-di-stile-non-stato-trovato-nel-percorso","errorCode":null,"errorMessage":"Il file di stile non è stato trovato nel percorso: {style_path}","messagePattern":"Il file di stile non è stato trovato nel percorso: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/libs/resume_and_cover_builder/resume_generator.py","lineNumber":32,"sourceCode":"    def __init__(self):\n        pass\n    \n    def set_resume_object(self, resume_object):\n         self.resume_object = resume_object\n         \n\n    def _create_resume(self, gpt_answerer: Any, style_path):\n        # Imposta il resume nell'oggetto gpt_answerer\n        gpt_answerer.set_resume(self.resume_object)\n        \n        # Leggi il template HTML\n        template = Template(global_config.html_template)\n        \n        try:\n            with open(style_path, \"r\") as f:\n                style_css = f.read()  # Correzione: chiama il metodo `read` con le parentesi\n        except FileNotFoundError:\n            raise ValueError(f\"Il file di stile non è stato trovato nel percorso: {style_path}\")\n        except Exception as e:\n            raise RuntimeError(f\"Errore durante la lettura del file CSS: {e}\")\n        \n        # Genera l'HTML del resume\n        body_html = gpt_answerer.generate_html_resume()\n        \n        # Applica i contenuti al template\n        return template.substitute(body=body_html, style_css=style_css)\n\n    def create_resume(self, style_path):\n        strings = load_module(global_config.STRINGS_MODULE_RESUME_PATH, global_config.STRINGS_MODULE_NAME)\n        gpt_answerer = LLMResumer(global_config.API_KEY, strings)\n        return self._create_resume(gpt_answerer, style_path)\n\n    def create_resume_job_description_text(self, style_path: str, job_description_text: str):\n        strings = load_module(global_config.STRINGS_MODULE_RESUME_JOB_DESCRIPTION_PATH, global_config.STRINGS_MODULE_NAME)\n        gpt_answerer = LLMResumeJobDescription(global_config.API_KEY, strings)\n        gpt_answerer.set_job_description_from_text(job_description_text)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/libs/resume_and_cover_builder/resume_generator.py#L14-L50","documentation":"ResumeGenerator._create_resume opens the style CSS file to inject it into the HTML template. If open(style_path) raises FileNotFoundError (path points nowhere), it is re-raised as a ValueError with the Italian message 'Il file di stile non è stato trovato nel percorso: ...' (the style file was not found at the path).","triggerScenarios":"Passing a style_path that does not exist on disk: deleted/moved CSS file, wrong styles directory, relative path resolved from a different working directory, or a style name that maps to no file.","commonSituations":"Bundled styles moved after packaging, running the app from a different CWD so relative style paths break, or user-supplied custom style paths that are wrong.","solutions":["Verify the style file exists at the exact path passed (os.path.exists) before generating.","Use absolute paths resolved from a configured styles directory instead of CWD-relative paths.","If the file was moved/renamed, update the style configuration or restore the CSS file."],"exampleFix":"# before\nhtml = generator.create_resume('styles/missing.css')\n# after\nfrom pathlib import Path\nstyle = Path('styles') / 'modern.css'\nassert style.is_file(), f'missing style: {style}'\nhtml = generator.create_resume(str(style.resolve()))","handlingStrategy":"type-guard","validationCode":"import os\nif not os.path.isfile(style_path):\n    raise FileNotFoundError(f'style not found: {style_path}')\nhtml = generator.create_resume(style_path)","typeGuard":"def is_readable_style(p) -> bool:\n    import os\n    return isinstance(p, str) and os.path.isfile(p)","tryCatchPattern":"try:\n    html = generator.create_resume(style_path)\nexcept ValueError as e:\n    if 'non è stato trovato' in str(e):\n        style_path = str((STYLES_DIR / 'default.css').resolve())\n        html = generator.create_resume(style_path)\n    else:\n        raise","preventionTips":["Resolve style paths to absolute paths from a configured styles root.","Check file existence before generation and keep bundled styles under version control."],"tags":["python","file-not-found","css","resume"],"backgroundTag":"file-not-found","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}