I'm a python noob so I'm probably doing something simple very wrong, but...
I'm trying to run the example from the documentation, but it says there's a syntax error in graphics.py.
Code:
from pdf_annotate import PdfAnnotator, Location, Appearance
a = PdfAnnotator('a.pdf')
a.add_annotation(
'square',
Location(x1=50, y1=50, x2=100, y2=100, page=0),
Appearance(stroke_color=(1, 0, 0), stroke_width=5),
)
a.write('b.pdf') # or use overwrite=True if you feel lucky
In terminal:
python sample.py
Output:
Traceback (most recent call last):
File "sample.py", line 1, in <module>
from pdf_annotate import PdfAnnotator, Location, Appearance
File "/Users/myusername/Library/Python/2.7/lib/python/site-packages/pdf_annotate/__init__.py", line 2, in <module>
from pdf_annotate.annotator import PdfAnnotator
File "/Users/myusername/Library/Python/2.7/lib/python/site-packages/pdf_annotate/annotator.py", line 15, in <module>
from pdf_annotate.annotations.image import Image
File "/Users/myusername/Library/Python/2.7/lib/python/site-packages/pdf_annotate/annotations/image.py", line 19, in <module>
from pdf_annotate.annotations.rect import RectAnnotation
File "/Users/myusername/Library/Python/2.7/lib/python/site-packages/pdf_annotate/annotations/rect.py", line 12, in <module>
from pdf_annotate.config.appearance import set_appearance_state
File "/Users/myusername/Library/Python/2.7/lib/python/site-packages/pdf_annotate/config/appearance.py", line 26, in <module>
from pdf_annotate.graphics import ContentStream
File "/Users/myusername/Library/Python/2.7/lib/python/site-packages/pdf_annotate/graphics.py", line 130
new_parents = (*parents, BaseCommand, namedtuple_klass)
^
SyntaxError: invalid syntax
I'm a python noob so I'm probably doing something simple very wrong, but... I'm trying to run the example from the documentation, but it says there's a syntax error in graphics.py. Code:
In terminal:
Output:
Any idea what I'm doing wrong?