To save you some future trouble, since you're opening a file with an unknown amount of elements in the arrays:
What are you trying to do here? I see that you use the variable p later in the program. Are you trying to create a list/tuple here?:
Why is tSquare a function parameter if you're not going to use it?
This won't work because p doesn't have any elements. See above for the proper way to initialize p.
In your arguments, make sure you put parenthesis after residuals, residuals(). Unless you're trying to pass the object as an argument, which I doubt.
Anyway, I would help more, but I have no idea what leastsq() and Tsquare-peval() do. Post the function definitions of those and I can help out on the arguments and return statement.