#!/usr/bin/env python3
"""Test pour reproduire l'erreur du GUI."""

from pathlib import Path
import anonymizer_core_refactored_onnx as core
from config_defaults import RUNTIME_DICTIONARIES_CONFIG_PATH

# Tester avec un seul PDF
test_pdf = Path("/home/dom/Téléchargements").rglob("*.pdf")
test_pdf = next(test_pdf, None)

if test_pdf:
    print(f"Test avec: {test_pdf}")
    try:
        result = core.process_pdf(
            test_pdf,
            Path("/tmp/test_gui"),
            make_vector_redaction=False,
            also_make_raster_burn=True,
            config_path=RUNTIME_DICTIONARIES_CONFIG_PATH,
            use_hf=False,
        )
        print(f"✅ Succès: {result}")
    except Exception as e:
        print(f"❌ Erreur: {e}")
        import traceback
        traceback.print_exc()
else:
    print("Aucun PDF trouvé")
