| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# simplejson::tool Namespace Reference

## Functions
def | main

## Function Documentation

def simplejson::tool::main | ( |  | ) |

Definition at line 16 of file tool.py.

    00016           :
    00017     if len(sys.argv) == 1:
    00018         infile = sys.stdin
    00019         outfile = sys.stdout
    00020     elif len(sys.argv) == 2:
    00021         infile = open(sys.argv[1], 'rb')
    00022         outfile = sys.stdout
    00023     elif len(sys.argv) == 3:
    00024         infile = open(sys.argv[1], 'rb')
    00025         outfile = open(sys.argv[2], 'wb')
    00026     else:
    00027         raise SystemExit(sys.argv[0] + " [infile [outfile]]")
    00028     try:
    00029         obj = simplejson.load(infile)
    00030     except ValueError, e:
    00031         raise SystemExit(e)
    00032     simplejson.dump(obj, outfile, sort_keys=True, indent=4)
    00033     outfile.write('\n')
    00034
    00035
    if __name__ == '__main__':