From 8eb2e3e21dcda0ef31f69e1eb77ceee0a4b8c307 Mon Sep 17 00:00:00 2001
From: Daniel STAN <daniel.stan@crans.org>
Date: Thu, 24 May 2012 10:40:40 +0200
Subject: [PATCH] =?UTF-8?q?converter=20n'=C3=A9crase=20plus?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 converter.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/converter.py b/converter.py
index db2bb38..6591b1b 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()}))
-- 
GitLab