benwiggy / PDFsuite

Python scripts, Automator Services and Quartz Filters for MacOS (OS X) that create, manipulate, and query PDF files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem in python2 and python3 with applying Quartfilter

johnwwweissberg opened this issue · comments

I am using BigSur. I see the same problem with python 2 and python 3:

python quartzfilter.py /home/johnweissberg/Desktop/wp2print-flyer-a4-with-bleed.pdf '/System/Library/Filters/Gray Tone.qfilter' /home/johnweissberg/Desktop/wp2print-flyer-a4-with-bleed-gray-quartzfilter.pdf

Traceback (most recent call last):
File "quartzfilter.py", line 69, in main
pdfDoc.writeToFile_withOptions_(outputfile, dict)
AttributeError: 'NoneType' object has no attribute 'writeToFile_withOptions_'

Is that really the path to your user domain? /home isn't normally used on macOS -- it's /Users.
I would suggest using ~/Desktop as a relative path, in any case.

I can't reproduce a problem here. The error suggests that you don't have a valid PDF object.

You are right. I am an idiot. Sorry for disturbing you.

Tips: you can call the scripts directly without typing 'python' first. Also, you can drag your files onto the Terminal window, and their pathname will be entered onto the line.
Note that you can use just the name of any installed filter, without the path, e.g. 'Gray Tone.qfilter'.