Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Program exits without reporting any error in python

I have this code:

#python 2.7.15

import pyautogui
import threading
import time
import msvcrt
from threading import Thread
import win32api

#launcher pos x:868 y:975
#rocket pos x:829 y:936

def click():
        state = win32api.GetKeyState(0x01)
        click = win32api.GetKeyState(0x01)
        if state != click:
                click = a
                print a
                if a < 0:
                        pyautogui.hotkey("ctrlleft")

def rocket():
        rocket = True
        while rocket:
            pyautogui.hotkey("2")
            time.sleep(0.5)
            pyautogui.hotkey("7")
            time.sleep(20)


key = msvcrt.getche()
if key == 'z':
        click()
elif key == 'x':
    if __name__ == '__main__':
            Thread(target = click).start()
            Thread(target = rocket).start()

When I run it I give z or x but program terminates without giving me any error. I have tried running it from cmd but nothing again. Neither Visual Studio nor Python IDE gives me a compile error, code executes without problem.

Comments