When you receive an error message indicating that Python cannot read the arguments, this is usually because the number of arguments you passed is equal to the number of arguments required, but you are missing some necessary arguments, including some optional arguments. In this case, you have the following definition:
def integrate(f, z, gamma, t, lower, upper, exact=True):
and the following call:
integrate(f, z, gamma, 0, 2*sy.pi, exact=True)
If we align them, we will see
def integrate(f, z, gamma, t, lower, upper, exact=True): integrate(f, z, gamma, 0, 2*sy.pi, exact=True)
that you are missing one of lower , upper or t , but since you provided exact , the error message gets confused.
Python 3 has a better error message for things like this:
>>> def f(a, b=0): pass ... >>> f(b=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: f() missing 1 required positional argument: 'a'