Skip to content

Commit

Permalink
- Redirect Ghostscript error output to stderr.
Browse files Browse the repository at this point in the history
- renamed path to library_path
- specified comment
  • Loading branch information
timschneider committed Jan 9, 2025
1 parent 4cddd9e commit b952229
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions eu_einvoice/european_e_invoice/custom/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,8 @@ def _get_icc_profile_path() -> str:
if not search_paths:
raise RuntimeError("Unable to find /lib path in Ghostscript search paths")

path = search_paths.group(2).strip()
icc_path = os.path.join(path[:-4], "iccprofiles")
library_path = search_paths.group(2).strip()
icc_path = os.path.join(library_path[:-4], "iccprofiles")

if not os.path.exists(icc_path):
raise RuntimeError("Unable to find ICC profiles folder in Ghostscript search paths.")
Expand All @@ -828,13 +828,14 @@ def _convert_pdf_to_pdfa(pdf_data: bytes) -> bytes:
cwd = None
if not os.path.isfile("srgb.icc"):
# the PDFA_def.ps file requires the srgb.icc file to be present in the current directory
# if it is not present, change the current working directory to the Ghostscript installation
# if it is not present, change the current working directory to the icc profile path.
cwd = _get_icc_profile_path()

with subprocess.Popen(
[
"gs",
"-q",
"-sstdout=%stderr",
"-dPDFA=3",
"-dBATCH",
"-dNOPAUSE",
Expand Down

0 comments on commit b952229

Please sign in to comment.