def main(dbfile, cmd): if (not os.path.exists(dbfile) or not dbfile.endswith(".db")): raise FileExistsError conn = sqlite3.connect(dbfile) gAnswer = Answer(conn) gAnswer.Loads() import sys if cmd: CmdShell(gAnswer).onecmd(cmd) else: CmdShell(gAnswer).cmdloop()