Add an extra yield in progress_generator
authorNikos Skalkotos <skalkoto@grnet.gr>
Thu, 8 Mar 2012 16:51:55 +0000 (18:51 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Thu, 8 Mar 2012 16:51:55 +0000 (18:51 +0200)
This is needed to suppress the StopIteration exception

image_creator/disk.py

index 0d30f96..6d0ad1f 100644 (file)
@@ -128,6 +128,7 @@ def progress_generator(total):
         if i < position:
             continue
         position = yield
+    yield #suppress the StopIteration exception
 
 
 class DiskDevice(object):
@@ -175,8 +176,6 @@ class DiskDevice(object):
         if self.progress_bar is None:
             self.progress_bar = progress_generator(total)
             self.progress_bar.next()
-            if position == 1:
-                return
 
         self.progress_bar.send(position)