You want to output a numerical value to a file in your python script.
However you get an error:
>>>TypeError: argument 1 must be string or read-only character buffer, not int
No python is not wrong but the solution is very simple. cast it to string:
How easy is that?