~didrocks/unity/altf10

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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) != 2:
        raise UserError("Wrong number of arguments supplied.")
    grackle = client.GrackleClient('localhost', 8123)
    grackle.put_message(args[0], args[1], 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)