Let init print message if database already exists.

This commit is contained in:
voussoir 2022-03-08 17:03:50 -08:00
parent da0e6a59f7
commit 1bc59311c9
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -326,6 +326,14 @@ def generate_thumbnail_argparse(args):
return 0 return 0
def init_argparse(args): def init_argparse(args):
global photodb
try:
load_photodb()
except etiquette.exceptions.NoClosestPhotoDB:
pass
else:
pipeable.stderr(f'PhotoDB {photodb} already exists.')
return 0
photodb = etiquette.photodb.PhotoDB(create=True) photodb = etiquette.photodb.PhotoDB(create=True)
photodb.commit() photodb.commit()
return 0 return 0