Python syntax error except exception, e: ^ syntax error: invalid syntax

The reason this is a problem is because python2 and python3 have different syntax
Python2 and 3 deal with the except clause in a slightly different syntax, which is worth noting;
Python2

try:
    print ("hello world")
except ZeroDivisionError, err:      # , Add reason parameter name 
    print ('Exception: ', err)

Python3

try:
    print ("hello,world")
except ZeroDivisionError as err:        # as Add reason parameter name 
    print ('Exception: ', err)

As seems to work if you want compatibility

Read More: