File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,10 @@ def create_all_users_batch():
35
35
36
36
# This function can create several users, DBs and permissions associated
37
37
# 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 ):
40
42
with open (file ) as inputfile ,\
41
43
open ('all_credentials.txt' , 'wt' ) as user_credentials_file :
42
44
@@ -82,8 +84,8 @@ def create_all_users_batch():
82
84
print (f'{ login } \n { create_DB_Permission .text } ' )
83
85
else :
84
86
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. ' )
87
89
88
90
89
91
def create_DB ():
You can’t perform that action at this time.
0 commit comments