remove usage of unicode

It was never used and breaks py3k.
there is no file function in py3k
use a StringIO that works with str for logging