Created
June 3, 2014 12:41
-
-
Save thinkjson/2785b4d88a8e7e893d8c to your computer and use it in GitHub Desktop.
say REPL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cmd | |
| import os | |
| import subprocess | |
| import shlex | |
| from pipes import quote | |
| devnull = open(os.devnull, 'w') | |
| class Voice(cmd.Cmd): | |
| """Simple command processor example.""" | |
| prompt = '(say) ' | |
| def default(self, line): | |
| subprocess.Popen(shlex.split("say %s" % quote(line)), stdout=devnull, stderr=devnull) | |
| if __name__ == '__main__': | |
| try: | |
| Voice().cmdloop() | |
| except KeyboardInterrupt: | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment