简体   繁体   中英

macOS python PDF service denied access in macOS Catalina

Since many years I have been using a Python script, to add a "virtual printer" to my macOS printing dialogue and print on a PDF stationery from any application.

The script is placed within ~/Library/PDF Services , took sys.argv[3] as an input file, merged the input file with a given PDF stationery and saved it in ~/Downloads.

I was happy until I updated to macOS Catalina and always got this message from Console:

Sandbox: Python(30225) System Policy: deny(1) file-read-data /Users/me/Documents/stationery.pdf

It seems that, due to the new permissions in macOS Catalina, the script cannot access the stationery file anymore. Python however has full hard disk access.

If I run the same script from the Terminal, everything works fine.

How can I grant the script access to the required document ( /Users/me/Documents/stationery.pdf ) when executed from withing the printing dialogue?

"Full Disk Access" is a bit of a misnomer, as it doesn't cover access to ~/Documents , ~/Desktop , ~/Downloads , external and Network drives.

Unfortunately, you can't easily 'add' processes to the Files and Folders access list.

You should fix the problem by storing your stationery files outside the protected folders, such as ~/Library/My Stationery (or some such). You may also need to change the filepath of the resultant file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM