File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 11def check ():
22 with open ("firsttime.txt" ,"r" ) as a :
3- if a .read ()== "True" :
3+ if a .read (). strip () == "True" :
44 return True
55 else :
66 return False
Original file line number Diff line number Diff line change 1- True
1+ False
Original file line number Diff line number Diff line change 44import mysql .connector
55
66from mysql .connector import errorcode
7-
7+ existing = 0
88TABLES = {}
99TABLES ['employees' ] = (
1010 "CREATE TABLE `employees` ("
@@ -109,6 +109,7 @@ def connectionquery():
109109 return query
110110
111111def querycheck ():
112+ global existing
112113 conn = connectionquery ()
113114 ans = False
114115 if conn != "" :
@@ -125,6 +126,7 @@ def querycheck():
125126 except mysql .connector .Error as err :
126127 if err .errno == errorcode .ER_TABLE_EXISTS_ERROR :
127128 print ("already exists." )
129+ existing += 1
128130 else :
129131 print (err .msg )
130132 else :
@@ -151,6 +153,7 @@ def mysqlsetup():
151153 querycheck ()
152154
153155def setup ():
156+ global existing
154157 while check .check ():
155158 print ("\n \n -----------------Welcome to the Project!!!-------------------" )
156159 print ("This is the setup process which runs when the user uses the program for the first time." )
@@ -163,6 +166,10 @@ def setup():
163166 break
164167 if ans2 == "1" :
165168 mysqlsetup ()
169+ if existing == 6 :
170+ with open ("firsttime.txt" ,"w" ) as f :
171+ f .write ("False" )
172+ continue
166173 if ans2 == "2" :
167174 print ("\n This is under development :). Please use mysql till then..." )
168175 elif ans2 != "1" or ans2 != "2" :
You can’t perform that action at this time.
0 commit comments