import os
import subprocess
import re
import ctypes


obj=subprocess.Popen("wmic os get osarchitecture",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
result,error=obj.communicate()
if error:
    print(error)
else:
    operating_system = result.split()

if '64-bit' in operating_system :
    if os.path.exists("C:\\Program Files (x86)\\Malwarebytes' Anti-Malware"):
        command = '"'+'c:\\program files (x86)\\malwarebytes'+"'"+' anti-malware\\unins000.exe'+'"'+' /verysilent /suppressmsgboxes /norestart'
        cmd = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        result_1,error_1=cmd.communicate()
        if error_1:
            print(error_1)
        else:
            print("Malwarebytes Anti-Malware Uninstallation Completed")
            
    else:
        print("Malwarebytes Anti-Malware is not found in your device")
else:        
    if os.path.exists("C:\\Program Files\\Malwarebytes' Anti-Malware"):
        command = '"'+'c:\\program files\\malwarebytes'+"'"+' anti-malware\\unins000.exe'+'"'+' /verysilent /suppressmsgboxes /norestart'
        cmd = subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        result_1,error_1=cmd.communicate()
        if error_1:
            print(error_1)
        else:
            print("Malwarebytes Anti-Malware Uninstallation Completed")
            
    else:
        print("Malwarebytes Anti-Malware is not found in your device")