Antoine Pitrou, 25.04.2010 02:16:
Another possibility is to open the file in binary mode and do the encoding yourself when writing text. This might actually be a better solution, since I'm not sure RTF uses utf-8 by default.
That's a lot cleaner as it doesn't use two interfaces to write to the same file, and doesn't rely on any specific coordination between those two interfaces.
Stefan -- http://mail.python.org/mailman/listinfo/python-list