0

I made this python program that is copying large files using robocopy. I want to pass the progress that robocopy shows in console to a tkinter label. Sadly i can't quite understand how to do that.

selection_platf= len(os.name)

def copy_build_button():
    if selection_platf < 11:
        subprocess.call(["robocopy", src , dest , r"/XF", 'BSyncPackage.zip', "/S"])
    else: #for linux
        subprocess.call(["robocopy", src2 , dest , "/S"])


def copy_thread():
    thread_1 = threading.Thread(target=copy_build_button)
    thread_1.start()

When i press the copy button the "copy_thread" function is called and starts a thread with the robocopy code. As i said above, i want to somehow pass the robocopy progress output from console to a label.

Thanks.

  • Possible Duplicate? https://stackoverflow.com/questions/7684900/my-tkinter-gui-is-too-static – jhaagsma Apr 24 '19 at 17:10
  • 1
    Possible duplicate of [How to redirect output with subprocess in Python?](https://stackoverflow.com/questions/4965159/how-to-redirect-output-with-subprocess-in-python) – MyStackRunnethOver Apr 24 '19 at 17:59
  • I'm trying my best to make it work using those 2 examples but i think i'm just not experienced enough.. If someone could explain how to adapt those explanations to my code that is using robocopy that will be great. Tried to make it work by adding the following code but i get an error: `cmd_line = ['robocopy'] p = subprocess.Popen(cmd_line, shell=True) os.waitpid(p.pid, 0)` saying "ChildProcessError: [Errno 10] No child processes" – Florin Moraru Apr 25 '19 at 00:13

0 Answers0