1 year ago

#338587

test-img

erfannjz

why i cant terminate my process via subprocess terminate?

What's wrong with my code?

I can't terminate my proc

class variables:
    var_bhop = IntVar()
    proc_bhop = None

def fbhop():
    if variables.var_bhop.get() == 1:
        variables.proc_bhop = Popen('py BHop.py', cwd='utils', shell= True)
    else:
        variables.proc_bhop.terminate()

I tried all the ways I knew

But none of them worked

Class, Global key, Change statement from else to elif and second if

And you need to know that I use Tkinter for my application GUI

python

tkinter

subprocess

global-variables

class-variables

0 Answers

Your Answer

Accepted video resources