freemyipod r611 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r610‎ | r611 | r612 >
Date:18:48, 13 February 2011
Author:theseven
Status:new
Tags:
Comment:
misc.py: Replace non-printable characters with escape sequences instead of throwing an exception in the logger
Modified paths:
  • /emcore/trunk/tools/misc.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/misc.py
@@ -79,12 +79,12 @@
8080 if majorver() > 2:
8181 sys.stdout.write(text)
8282 else:
83 - sys.stdout.write(text.encode(sys.stdout.encoding))
 83+ sys.stdout.write(text.encode(sys.stdout.encoding, "replace"))
8484 if target == "stderr":
8585 if majorver() > 2:
8686 sys.stdout.write(text)
8787 else:
88 - sys.stderr.write(text.encode(sys.stderr.encoding))
 88+ sys.stderr.write(text.encode(sys.stderr.encoding, "replace"))
8989 elif target == "file":
9090 with open(self.logfile, 'a') as f:
9191 f.write(text)