diff --git a/converter.py b/converter.py index db2bb38cce63b5be846cb4da2cec631949971adb..6591b1bd043011618a160b04a51740008b6a23a3 100755 --- a/converter.py +++ b/converter.py @@ -1,6 +1,9 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + import json import glob -import os +import os,sys # Basic converter to json, avec roles nounous partout init_path = '/home/dstan/crans/passwords/' @@ -12,7 +15,13 @@ filenames = glob.glob('*.asc') encoder=json.JSONEncoder() for filename in filenames: - nf = file(final_path+filename[:-4]+'.json','w') + fname=final_path+filename[:-4]+'.json' + if os.path.exists(fname): + print "%s already exists, ignored" % filename + continue + else: + print "Traitement de %s" % filename + nf = file(fname,'w') nf.write(encoder.encode({'roles':['nounous']\ ,'contents':open(filename).read()}))