71GA
71GA

Reputation: 1391

What is this new Python syntax called?

I am dealing with some installation scripts from Github and am trying to execute this script which looks like it fails because of these lines:

current_app: 'PillarServer' = LocalProxy(_get_current_app)
"""the current app, annotated as PillarServer"""

Executing it with Python 3.5 returns this error:

$python main.py
  File "main.py", line 33
    current_app: 'PillarServer' = LocalProxy(_get_current_app)
               ^
SyntaxError: invalid syntax

Can anyone help me a bit here? I am not an expert in Python but am forced to use this script.

Upvotes: 2

Views: 267

Answers (1)

chepner
chepner

Reputation: 531075

That's a PEP-526-style variable annotation. You appear to be running the code with an older version of Python; you need to use Python 3.6 or later to recognize that syntax.

Upvotes: 4

Related Questions