You are not calling the outfile.close
method.
No need to flush here, just call close properly:
outfile = open(inputfile, 'w')
outfile.write(argument)
outfile.close()
or better still, use the file object as a context manager:
with open(inputfile, 'w') as outfile:
outfile.write(argument)
This is all presuming that argument
is not an empty string, and that you are looking at the right file. If you are using a relative path in inputfile
what absolute path is used depends on your current working directory and you could be looking at the wrong file to see if something has been written to it.