python-json-logger
python-json-logger copied to clipboard
invalid syntax: RESERVED_ATTRS: Tuple[str, ...] = (
We are deploying code that has a dependency on jsonlogger and it is now throwing the below syntax error. any help would be appreicated. (we are using python 3.5)
plugins_1 | from pythonjsonlogger import jsonlogger plugins_1 | File "/usr/local/lib/python3.5/site-packages/pythonjsonlogger/jsonlogger.py", line 20 plugins_1 | RESERVED_ATTRS: Tuple[str, ...] = ( plugins_1 | ^ plugins_1 | SyntaxError: invalid syntax drsuser_plugins_1 exited with code 1
What Python version are you running this?
Line 20 syntax was updated to support PEP 561 (https://peps.python.org/pep-0561/) which distributes types with the package, specifically here it's the ...: Tuple[str, ...]
part, in this PR: https://github.com/madzak/python-json-logger/commit/4c72bedd4afb1e7c3aee05e256d5c741a8db58f7
I'm running this on python 3.5 and haven't had this problem before on v2.0.2
The full log below:
plugins_1 | Traceback (most recent call last):
plugins_1 | File "/usr/local/bin/py-skygear", line 5, in
~~You should add from __future__ import annotations
for older python versions~~
nvm: py35 support is dropped: https://github.com/madzak/python-json-logger/blob/705fe99cee679dbb57c3a2028dcdada3b60aaef4/setup.py#L32
If you run into this on later versions feel free to re-open.