As several people mentioned in comments, it's clear that what is happening here is that a Python-2.x script is being interpreted by a Python-3.x interpreter.
Systems with both flavors of Python installed will sometimes use the name python2 to invoke the Python 2.x interpreter and python3 to invoke the Python 3.y interpreter. (The value of x and y here may vary, though no one should be using anything earlier than Python 2.7 these days, and it's a good idea to move to Python 3 soon.)
Converting a Python 2 script to Python 3 is usually pretty easy, but if you have both interpreters installed, and your script itself simply reads:
#! /usr/bin/env python
... script ...
the quickest way to make it use Python 2, if that's still on your system under the name python2, is to change the first line to read:
#! /usr/bin/env python2
The first line may vary somewhat but the general idea is that #! is followed by the full path name of the interpreter, then any argument for that interpreter. Using /usr/bin/env as the interpreter allows further path-searching, so that you can then have it find python, python2, python3, python3.6, python3.7, etc., as appropriate.
As YSC answered, from the Git side, you can just skip the entire pre-commit script.
raw_inputis Python 2, and renamed to simplyinputin Python 3. Things don't just randomly break like that, someone changed the hook or your system. You need to figure out which it was, we can't do that for you.