Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- import sys
- def main():
- if len(sys.argv) < 2:
- print "requires JSON file"
- else:
- try:
- x = json.load(open(sys.argv[1],"rb"))
- print "file is correct"
- return
- except:
- pass
- file = open(sys.argv[1],"a")
- file.write("]")
- file.close()
- try:
- x = json.load(open(sys.argv[1],"rb"))
- print "file fixed correctly"
- except:
- print "file broken"
- if __name__ == "__main__":
- main()
Add Comment
Please, Sign In to add comment