Skip to content

[BUG]: 'Union' not defined in main.py #135

Description

@Cubix33

⚡️ Describe the Bug

Running the application via the make exec command crashes immediately upon startup with a NameError: name 'Union' is not defined. This occurs because Union is used for type hinting the pdf_form_path parameter in the run_pdf_fill_process function signature in src/main.py, but the module is never imported.

👣 Steps to Reproduce

  1. Ensure the Docker containers are running (docker compose up -d).
  2. Run the command make exec (or docker compose exec app python3 src/main.py) in the terminal.
  3. See the NameError crash output immediately.

📉 Expected Behavior

The application should start successfully, detect the PDF, and begin the extraction/filling process without throwing Python standard library import errors.

🖥️ Environment Information

  • OS: Windows / WSL 2 (Ubuntu)
  • Docker/Compose Version: Docker Desktop latest
  • Ollama Model used: Mistral

📸 Screenshots/Logs

Traceback (most recent call last):
  File "/app/src/main.py", line 14, in <module>
    def run_pdf_fill_process(user_input: str, definitions: list, pdf_form_path: Union[str, os.PathLike]):
                                                                                ^^^^^
NameError: name 'Union' is not defined

🕵️ Possible Fix

Add the missing import statement from the standard typing library at the top of src/main.py:

from typing import Union

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions