Muhammad Usman
Muhammad Usman

Reputation: 10936

python zip extraction in background

I am uploading large zip files in to the system. where zip extraction may take several minutes. I want to send this zip extraction in to the background as don't want to block the UI.

_.unzip(filePath ,uploadPath) #is it possible to make it async or independent?

Upvotes: 1

Views: 917

Answers (1)

Maltysen
Maltysen

Reputation: 1946

Use the threading module!

import threading

def do_unzipping():
    _.unzip(filePath ,uploadPath)

    update_ui("Unzipping Finished!")

threading.Thread(target = do_unzipping).start()
continue_with_unblocked_ui()

Nice threading tutorial.

Upvotes: 1

Related Questions