Skip to content

Commit a4d11f6

Browse files
committed
update
1 parent e04047a commit a4d11f6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

couchdb-simple-management-tool.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ def create_all_users_batch():
3535

3636
# This function can create several users, DBs and permissions associated
3737
# with each user
38-
file = input('Please type the file name for user creation: ')
39-
try:
38+
39+
from os import path
40+
file = input('Please type the filename with users (one per line): ')
41+
if path.exists(file) and path.isfile(file):
4042
with open(file) as inputfile,\
4143
open('all_credentials.txt', 'wt') as user_credentials_file:
4244

@@ -82,8 +84,8 @@ def create_all_users_batch():
8284
print(f'{login}\n{create_DB_Permission.text}')
8385
else:
8486
print(f'{createuser.text}')
85-
except IOError:
86-
print(f'File not found / error loading file: {IOError}')
87+
else:
88+
print(f'File "{file}" not found or not a regular file.')
8789

8890

8991
def create_DB():

0 commit comments

Comments
 (0)