Files
crystal_informe_venta_presu…/test_load.py
T
2026-05-18 09:28:55 -05:00

33 lines
1.1 KiB
Python

import clr
import sys
from pathlib import Path
# Try to find the DLL
gac_path = r"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\v4.0_13.0.4000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll"
print(f"Checking path: {gac_path}")
print(f"Exists: {Path(gac_path).exists()}")
try:
print("Attempting to add reference...")
# Try adding by full path first
clr.AddReference(gac_path)
print("Reference added successfully by path.")
except Exception as e:
print(f"Failed to add reference by path: {e}")
try:
print("Attempting to add reference by name...")
clr.AddReference("CrystalDecisions.CrystalReports.Engine")
print("Reference added successfully by name.")
except Exception as e2:
print(f"Failed to add reference by name: {e2}")
try:
print("Attempting import...")
# pyrefly: ignore [missing-import]
from CrystalDecisions.CrystalReports.Engine import ReportDocument
print("Import successful!")
except Exception as e:
print(f"Import failed: {e}")
import traceback
traceback.print_exc()