Error in def_main(), excecute takes 1 positional argument, but two was given. If I give only 1 argument the same result : def execute_command(cmd):
    f = open(log.name, "w")
    try:
        subprocess.Popen(cmd, 0, f, f) 
    except WindowsError:
        cmd[0] = cmd[0] + ".com"
        subprocess.Popen(cmd, 0, f, f) #work-around
    rc = process.wait()
    if rc != 0:
        print("Error: failed to execute command:", cmd)
        print(error)
    return result
    
def_main():
    execute_command(["tree", "C:\\"], "treelog.txt")
    return 