Переглянути джерело

remove exception, exit normally

oz123 11 роки тому
батько
коміт
732d72ec4c
1 змінених файлів з 4 додано та 1 видалено
  1. 4 1
      pwman/data/convertdb.py

+ 4 - 1
pwman/data/convertdb.py

@@ -26,6 +26,7 @@ from pwman.util.crypto import CryptoEngine
 import pwman.data.factory
 from pwman.util.callback import Callback
 from pwman.data.nodes import NewNode
+import sys
 
 _NEWVERSION = 0.4
 
@@ -69,7 +70,9 @@ class PwmanConvertDB(object):
     def create_new_db(self):
         dest = '-newdb'.join(os.path.splitext(self.dbname))
         if os.path.exists('-newdb'.join(os.path.splitext(self.dbname))):
-            raise Exception("%s already exists, please move this file!" % dest)
+            print "%s already exists, please move this file!" % dest
+            sys.exit(2)
+
         self.newdb_name = '-newdb'.join(os.path.splitext(self.dbname))
 
         self.newdb = pwman.data.factory.create(self.dbtype, _NEWVERSION,