How to get filename as output from CUPS, not job id?

73 Views Asked by At

I am working on MacOS on a script to redirect print jobs to another printer.

This is portion of my code:

def on_created(self, event):
        if event.is_directory:
            return
        print(event.src_path)
        if event.src_path.startswith("/private/var/spool/cups"):
            if os.path.basename(event.src_path).startswith("d"):
                print(os.path.basename(event.src_path))
                print_job(event.src_path)
               

I guess this outputs me print job IDs, not filenames and i am unable to send these to printer this way. I believe this is cups configuration issue, because if i test it in other random folder, the output is correct.

Is there a CUPS setting that may affect this?

Thank you

Edit:

Just to clarify, i have tested this with random folders and with/without sudo. Both system folders and regular, my solution works but not in CUPS folder. Even if i change CUPS spool folder to something else like "Downloads".

0

There are 0 best solutions below