py/gadict_c5.py
changeset 399 a6a7036f3c6f
parent 394 4d45194c71b6
child 402 b47698d5ccab
equal deleted inserted replaced
398:54ef571cf72a 399:a6a7036f3c6f
    17 else:
    17 else:
    18     fout = open(fnout, "w")
    18     fout = open(fnout, "w")
    19 
    19 
    20 
    20 
    21 parser = gadict.Parser()
    21 parser = gadict.Parser()
    22 dom = parser.parse(fin)
    22 try:
    23 fin.close()
    23     dom = parser.parse(fin)
       
    24 except gadict.ParseException as ex:
       
    25     sys.stdout.write("{:s}{:s}\n".format(fgadict, repr(ex)))
       
    26     if __debug__:
       
    27         import traceback
       
    28         traceback.print_exc()
       
    29     exit(1)
       
    30 finally:
       
    31     fin.close()
    24 
    32 
    25 for idx in range(1, len(dom)):
    33 for idx in range(1, len(dom)):
    26     article = dom[idx]
    34     article = dom[idx]
    27     fout.write("_____\n\n")
    35     fout.write("_____\n\n")
    28     title = "; ".join(article[0].keys())
    36     title = "; ".join(article[0].keys())