Progress Finished Question - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Progress Finished Question (/thread-9983.html) |
RE: Progress Finished Question - malonn - May-23-2018 Media player? Media editor? But I was getting confused, but think I've tightened it up some. This time, I am sure the checksums match. It may not be pretty and least resource intensive, but it works: import os def copyFunc(source, destination): with open(source, 'rb') as f1, open(destination, 'wb') as f2: full_size = os.stat(source).st_size full = 0 increment = 10485760 while full < full_size: chunk = f1.read(increment) full += increment calc = full if calc + increment > full_size: calc += full_size - full f2.write(chunk) print(round(calc / full_size * 100, 1), '%\r') one = '397.64-desktop.exe' two = 'C:\\Users\Mark\Downloads\Ordenador\driver.exe' copyFunc(one, two)A problem is that it prints 100% twice. I have to fix that... RE: Progress Finished Question - wavic - May-23-2018 print(round(calc / full_size * 100, 1), '%', end='\r')victor at Jerry in ~ ↪ sha1sum '/media/storage/Download/Video/Etcher-Portable-1.3.1-x64.exe' aea0b63b9bc0881662dd47b036a5f1324f5a6ed3 /media/storage/Download/Video/Etcher-Portable-1.3.1-x64.exe victor at Jerry in ~ ↪ sha1sum '/tmp/Etcher-Portable-1.3.1-x64.exe' aea0b63b9bc0881662dd47b036a5f1324f5a6ed3 /tmp/Etcher-Portable-1.3.1-x64.exe RE: Progress Finished Question - malonn - May-23-2018 Alright then, thanks again for the help @wavic, it's much appreciated. I'm going to take a day or two to play with the code, see what comes of it. |