You want to output a numerical value to a file in your python script.
However you get an error:
>>>data=123246
>>>fileOut.write(data)
>>>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:
>>>fileOut.write(str(data))
How easy is that?
Go python!
Little Nibbles