import cmd import codecs, sys, locale g = sys.stdout sys.stdout = codecs.getwriter('ascii')(sys.stdout) #sys.stdout = g class HelloWorld(cmd.Cmd): """Simple command processor example.""" def do_greet(self, line): print "hello" def do_EOF(self, line): return True if __name__ == '__main__': HelloWorld().cmdloop()