Progressbar exception recursively copying empty directory
If we try to copy something recursively with an empty directory we try to start a progress bar with 0 operations. We should test for this and not start the progress bar.
Traceback (most recent call last):
File "/root/env/bin/cpobj", line 96, in <module>
args.multipart)
File "/root/env/lib/python2.6/site-packages/umobj/transfer.py", line 206, in obj_upload
pbar.start()
File "/root/env/lib/python2.6/site-packages/progressbar/__init__.py", line 311, in start
self.update(0)
File "/root/env/lib/python2.6/site-packages/progressbar/__init__.py", line 283, in update
self.fd.write(self._format_line() + '\r')
File "/root/env/lib/python2.6/site-packages/progressbar/__init__.py", line 243, in _format_line
widgets = ''.join(self._format_widgets())
File "/root/env/lib/python2.6/site-packages/progressbar/__init__.py", line 223, in _format_widgets
widget = format_updatable(widget, self)
File "/root/env/lib/python2.6/site-packages/progressbar/widgets.py", line 38, in format_updatable
if hasattr(updatable, 'update'): return updatable.update(pbar)
File "/root/env/lib/python2.6/site-packages/progressbar/widgets.py", line 184, in update
return '%3d%%' % pbar.percentage()
File "/root/env/lib/python2.6/site-packages/progressbar/__init__.py", line 208, in percentage
return self.currval * 100.0 / self.maxval
<type 'type'>: float division