diff options
Diffstat (limited to 'iutil.py')
-rw-r--r-- | iutil.py | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -138,20 +138,22 @@ def copyFile(source, to, pw = None): total = os.path.getsize(source) win = fn(title, text, total) - count = os.read(f, 262144) - total = 0 - while (count): - os.write(t, count) - total = total + len(count) - if pw: - win.set(total) - count = os.read(f, 16384) - - os.close(f) - os.close(t) + try: + count = os.read(f, 262144) + total = 0 + while (count): + os.write(t, count) + + total = total + len(count) + if pw: + win.set(total) + count = os.read(f, 16384) + finally: + os.close(f) + os.close(t) - if pw: - win.pop() + if pw: + win.pop() def memInstalled(): f = open("/proc/meminfo", "r") |