Repository: vaexio/vaex

Issue:
Failed to run `vaex convert file` command
I tried to convert a fits file with heads to hdf5:
`vaex convert file sample.fits sample.hdf5`

An error is thrown as following while :
```
Traceback (most recent call last):
  File "/data/tmp-venv/bin/vaex", line 10, in <module>
    sys.exit(main())
  File "/data/tmp-venv/lib/python3.7/site-packages/vaex/__main__.py", line 114, in main
    vaex.export.main([os.path.basename(args[0]) + " " + args[1]] + args[2:])
  File "/data/tmp-venv/lib/python3.7/site-packages/vaex/export.py", line 482, in main
    progressbar.finish()
  File "/data/tmp-venv/lib/python3.7/site-packages/vaex/misc/progressbar.py", line 95, in finish
    print(repr(self), file=self.output, end=' ')
  File "/data/tmp-venv/lib/python3.7/site-packages/vaex/misc/progressbar.py", line 104, in __repr__
    output = "\r" + bar + super(ProgressBar, self).__repr__()
  File "/data/tmp-venv/lib/python3.7/site-packages/vaex/misc/progressbar.py", line 59, in __repr__
    return self.format % self.info()
  File "/data/tmp-venv/lib/python3.7/site-packages/vaex/misc/progressbar.py", line 31, in info
    cpu_time_delta = self.stime - self.stime0 + self.utime - self.utime0
AttributeError: 'ProgressBar' object has no attribute 'stime0'
```

There is an issue in `progressbar.py`:
- `self.stime0` is only declared while `self.value` is zero. https://github.com/vaexio/vaex/blob/54d5d30e28360cbc0d35de9cba0c09c3c6ab016e/packages/vaex-core/vaex/misc/progressbar.py#L21

- but `self.stime0` is always accessed in the main path
https://github.com/vaexio/vaex/blob/54d5d30e28360cbc0d35de9cba0c09c3c6ab016e/packages/vaex-core/vaex/misc/progressbar.py#L31


Discussion:
Hi,

Thanks for the report, I'll try to reproduce that with a unittest, should be easy to fix I think, unless you or @JovanVeljanoski beats me to it :)

cheers,

Maarten
Hey, guys...just bumping this one. I'm having the same issue. If anybody else runs into this issue and is lost, you can pass the flag `--no-progress` and it'll run without an issue. For example:

`vaex convert --no-progress file sample.fits sample.hdf5`

Resolving patch:
diff --git a/packages/vaex-core/vaex/export.py b/packages/vaex-core/vaex/export.py
--- a/packages/vaex-core/vaex/export.py
+++ b/packages/vaex-core/vaex/export.py
@@ -133,6 +133,7 @@ def _export(dataset_input, dataset_output, random_index_column, path, column_nam
             futures.append(future)
 
     done = False
+    progress(0)
     while not done:
         done = True
         for future in futures:
diff --git a/packages/vaex-core/vaex/misc/progressbar.py b/packages/vaex-core/vaex/misc/progressbar.py
--- a/packages/vaex-core/vaex/misc/progressbar.py
+++ b/packages/vaex-core/vaex/misc/progressbar.py
@@ -91,14 +91,15 @@ def update(self, value):
         self.output.flush()
 
     def finish(self):
-        self.value = self.max_value
-        print(repr(self), file=self.output, end=' ')
+        if self.value != self.max_value:
+            self.value = self.max_value
+            print(repr(self), file=self.output, end=' ')
         self.output.flush()
 
 
     def __repr__(self):
         output = ''
-        count = int(self.fraction * self.width + 0.5)
+        count = int(round(self.fraction * self.width))
         space = self.width - count
         bar = "[" + (self.barchar * count) + (self.emptychar * space) + "]"
         output = "\r" + bar + super(ProgressBar, self).__repr__()


Test patch: