0

the log out code not working and it says "[Errno 2] No such file or directory" instead of opening that register window and i have already imported os in code python code

from tkinter import*
from PIL import Image,ImageTk #pip install pillow
from course import CourseClass
from student import StudentClass
from result import ResultClass
from report import ReportClass
from tkinter import messagebox
import os
class SRMS:
    def __init__(self,root):
        self.root = root
        self.root.title("Student Management System")
        self.root.geometry("1350x700+0+0")
        self.root.config(bg="white")

    def log_out(self):
        op=messagebox.askyesno("Confirm","Do you really want to logout?", parent=self.root)
        if op==True:
            self.root.destroy()
            os.system("python register.py")
        else:
            pass

if __name__=="__main__":
    root=Tk()
    obj=SRMS(root)
    root.mainloop()

1 Answers1

0

The filepath is incorrect. Be shure of beeing in the correct folder when executing the command (or use the correct path to call the script).

Otherwhise, you should call the script using a function instead using CMD. Check this post

Fran Arenas
  • 639
  • 6
  • 18