So, I don't have a complete answer here, but this has something to do with the new PEG parser that debuted in Python 3.9, because when I use it (it is the default parser on Python 3.9), I get the same error:
Python 3.9.1 (default, Dec 11 2020, 06:28:49)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> hdr_filenames = [
"20210311_105300_HDR.jpg",
"20210311_105306_HDR.jpg",
"20210311_105310_HDR.jpg",
"20210311_105314_HDR.jpg",
"20210311_105341_HDR.jpg", # order of last two have reversed exposures
"20210311_105323_HDR.jpg"
]
File "<stdin>", line 1
]
^
SyntaxError: multiple statements found while compiling a single statement
BUT You can revert to the old, LL(1) parser by passing a command line option, an voila! No error:
(py39) juanarrivillaga@50-254-139-253-static % python -X oldparser
Python 3.9.1 (default, Dec 11 2020, 06:28:49)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> hdr_filenames = [
"20210311_105300_HDR.jpg",
"20210311_105306_HDR.jpg",
"20210311_105310_HDR.jpg",
"20210311_105314_HDR.jpg",
"20210311_105341_HDR.jpg", # order of last two have reversed exposures
"20210311_105323_HDR.jpg"
]
>>> exit()
For those interested, the relevant PEP 617 about the new parser.
EDIT
So, this no-longer seems to be a problem on Python 3.9.2 (the latest version currently, I believe). So perhaps upgrade?
Python 3.9.2 (default, Mar 3 2021, 11:58:52)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> hdr_filenames = [
... "20210311_105300_HDR.jpg",
... "20210311_105306_HDR.jpg",
... "20210311_105310_HDR.jpg",
... "20210311_105314_HDR.jpg",
... "20210311_105341_HDR.jpg", # order of last two have reversed exposures
... "20210311_105323_HDR.jpg"
... ]
>>>