Mrt.exe launch in python

35 views Asked by At

How to launch MRT.exe in python?

I tried writing method for launching this program in my python program. here is code:

@typing.override
@functools.cache
def __interactive_mode__(self) -> None:
    subprocess.run(["C:\Windows\System32\mrt.exe"])

full code:

import customtkinter, tkinter, tkinter.messagebox, subprocess, pickle, functools, typing, sys, My_First_Aid_Kit_interface

type App = customtkinter.CTk()

executable_app: App = App

class Program[executable_app](customtkinter.CTk, My_First_Aid_Kit_interface.My_First_Aid_Kit_interface):
    
    WIDTH: typing.Final[int] = 650
    HEIGHT: typing.Final[int] = 500
    TITLE: typing.Final[str] = "My First Aid Kit"
    ICON: typing.Final[str] = ...
    COLOR_THEME: typing.Final[str] = "dark-blue"
    APPEARENCE_MODE: typing.Final[str] = "system"
    FONT_FOR_WIDGETS: typing.Final[str] = "Roboto Bold"
    WIDGET_SCALING: typing.Final[float] = 1.251 

    def __init__(self, *args, **kwargs) -> None:
        customtkinter.CTk.__init__(self, *args, **kwargs)
        
        customtkinter.set_appearance_mode(self.APPEARENCE_MODE)
        customtkinter.set_default_color_theme(self.COLOR_THEME)
        customtkinter.set_widget_scaling(self.WIDGET_SCALING)
        customtkinter.deactivate_automatic_dpi_awareness()
        
        self.title(self.TITLE)
        self.minsize(height=self.HEIGHT, width=self.WIDTH)
        self.resizable(False, False)
        self.protocol("WM_DELETE_WINDOW", lambda: sys.exit())

        self.font_for_widgets: customtkinter.CTkFont = customtkinter.CTkFont(family=self.FONT_FOR_WIDGETS, size=25)
        self.font_for_title: customtkinter.CTkFont = customtkinter.CTkFont(family=self.FONT_FOR_WIDGETS, size=72)
        self.font_for_small_title: customtkinter.CTkFont = customtkinter.CTkFont(family=self.FONT_FOR_WIDGETS, size=36)

        self.main_screen_title: customtkinter.CTkLabel = customtkinter.CTkLabel(master=self, text="My First Aid Kit", height=75, width=90, font=self.font_for_title)
        self.main_screen_title.place(x=15, y=3)
        
        self.main_screen_interactive_mode_button: customtkinter.CTkButton = customtkinter.CTkButton(master=self, text="интерактивни режим", height=25, width=75, font=self.font_for_widgets, fg_color="green", command=self.__interactive_mode__)
        self.main_screen_interactive_mode_button.place(x=1, y=85)
        
        self.main_screen_full_scan_button: customtkinter.CTkButton = customtkinter.CTkButton(master=self, text="пуно скенирање", height=25, width=75, font=self.font_for_widgets, fg_color="green", command=self.__full_scan__)
        self.main_screen_full_scan_button.place(x=1, y=120)
        
        self.main_screen_full_scan_with_virus_removal_button: customtkinter.CTkButton = customtkinter.CTkButton(master=self, text="пуно скенирање са брисањем вируса", height=25, width=75, font=self.font_for_widgets, fg_color="green", command=self.__full_scan_with_virus_removal__)
        self.main_screen_full_scan_with_virus_removal_button.place(x=1, y=155)
        
        self.main_screen_full_scan_with_virus_removal_button: customtkinter.CTkButton = customtkinter.CTkButton(master=self, text="подешавања", height=25, width=75, font=self.font_for_widgets, fg_color="green")
        self.main_screen_full_scan_with_virus_removal_button.place(x=1, y=190)
        
    @typing.override
    @functools.cache
    def __interactive_mode__(self) -> None:
        subprocess.run(["C:\Windows\System32\mrt.exe"])
        
    @typing.override
    @functools.cache
    def __full_scan__(self) -> None:
        subprocess.call(["MRT.exe /F"])
        
    @typing.override
    @functools.cache
    def __full_scan_with_virus_removal__(self) -> None:
        subprocess.call(["MRT.exe /F:Y"])    

    @functools.cache
    def __run__(self) -> None:
        self.mainloop()
        
if __name__ == "__main__":
   program: Program = Program()
   program.__run__()
        

As a result my program crashes and Visual Studio shows that "value is either too large or too small for int32". And when I close my program, mrt.exe appears. I don't know how is it possible.

0

There are 0 answers