import keyczar
from keyczar import keyczart
import os
directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'keyset')
if not os.listdir(directory):
    os.makedirs(directory)
    keyczart.main(['create','--location=keyset','--purpose=crypt','--name=crypt'])
    keyczart.main(['addkey','--location=keyset' ,'--status=primary'])
else:
    print 'Keyset directory already has something in there. Skipping key generation.'

@@ -126,16 +126,17 @@
 eyset')%0A
+%0A
 if not o
@@ -141,15 +141,19 @@
  os.
-listdir
+path.exists
 (dir
@@ -187,16 +187,47 @@
 rectory)
+%0A%0Aif not os.listdir(directory):
 %0A    key

Make the directory if it doesn't exist