You are not calling the close
and flush
methods. You need to place ()
after them to do this:
tmp.close()
tmp.flush()
etc.
Otherwise, you just have references to those methods. Below is a demonstration:
>>> def foo():
... return 'hi'
...
>>> foo
<function foo at 0x020B2540>
>>> foo()
'hi'
>>>