ghostscripts in python with watchdog

legaulph at gmail.com legaulph at gmail.com
Fri Feb 14 07:54:40 EST 2020


I'm not sure what happens, when I'm testing and suddenly I will start
getting this error.
Error: /undefinedfilename in (1)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--
--nostringval--  
 false   1   %stopped_push
Dictionary stack:
   --dict:732/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.50: Unrecoverable error, exit code 1


-----Original Message-----
From: Python-list <python-list-bounces+legaulph=gmail.com at python.org> On
Behalf Of Bheesham Persaud
Sent: Friday, February 14, 2020 1:26 AM
To: python-list at python.org
Subject: Re: ghostscripts in python with watchdog

Hey!

If you change the "-sOutputFile` parameter you pass into gswin64c.

For example, something like:

     output_directory = os.path.join(os.path.dirname(input_src), "out")

And then you should be able to modify the call to `os.system` to something
like:

     os.system(
         "gswin64c -q -dBATCH -dNOPAUSE"
         "-sOutputFile={output_directory}/page{page:04d}.pdf"
         " -dFirstPage={page} -dLastPage={page}"
         " -sDEVICE=pdfwrite {input_pdf}"
         .format(
             page=i,
             input_pdf=input_pdf,
             output_directory=output_directory
         )
     )
--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list