1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#!/usr/bin/env python import sys from grackle import client class UserError(Exception): """An error caused by a user mistake.""" def main(*args): if len(args) != 1: raise UserError("Wrong number of arguments supplied.") client.put_message(args[0], sys.stdin) if __name__ == '__main__': try: main(*sys.argv[1:]) sys.exit(0) except UserError, e: sys.stderr.write(str(e) + '\n') sys.exit(1) |