Fix mathicsserver errors when viewing documentation examples

Typo fixes only (no actual bug)
Fix readline breakage due to wrapped sys.stdout

It turns out that wrapping sys.stdout in a Python object (such as
codecs.StreamWriter) interferes with raw_input's use of readline. See
https://bugzilla.redhat.com/show_bug.cgi?id=448864#c15 for full
details.

Add a workaround that sets sys.stdout to the original file object
around the call to raw_input(), restoring it afterwards.