lundi 28 décembre 2015

Else statement returning to original script

I'm working on a login script using Python and SQLite and I just came across a weird error.

This is the code I got:

while c.fetchone() is not None:
    if oper in ["3350",""]:
        print(term.move(28,1))
        time.sleep(3)
        os.system("python /SABB/app1.py")

    elif oper == "1010":
        os.system("python /SABB/app2.py")

if oper == "/":
    sys.exit()

else:
    main('self')

It validates the username and password, and depending on the "oper" that was typed in, open either one of the available applications, which is working correctly.

But the else statement seems to have created a problem. When the user exits the applications, they are sent back to the login script. The same behavior as if the code was:

else:
    os.system("python /SABB/app1.py")
    main('self')

Any ideas?

Aucun commentaire:

Enregistrer un commentaire