0

I am trying to get the IP address and other details of Linux through my python code. when tmp = subprocess.call("./a.out") this line executes the code sticks here and this line subprocss.call("ifconfig") is not executed. as I cannot change the C code. so how can I make the next line run.

def execute():
    dirname = '/home/kali/Downloads'
    ext = ('.py','.c','.sh')
    try:
        for files in os.listdir(dirname):
            if files.endswith(ext):
                if files.endswith('.c'):
                    subprocess.call(["gcc", "code.c"])
                    tmp = subprocess.call("./a.out")
                    subprocss.call("ifconfig")
Hassan Turi
  • 334
  • 3
  • 14

1 Answers1

-1

I got answer for this question after a long time of research. It can be done with a function subprocess.communicate function. this function can communicate with the process.

Hassan Turi
  • 334
  • 3
  • 14