erwanp / qtplaskin

A graphical tool to explore ZdPlaskin Results
GNU Lesser General Public License v3.0
7 stars 5 forks source link

Fix: export data filename selection #5

Closed githeap closed 5 years ago

githeap commented 5 years ago

Hello @erwanp . Looks like PyQt4 -> PyQt5 transition bug. Try to export data to file File menu -> Export data... -> Chose filename in file selection dialog -> press Save button. You get exception

An unhandled exception was raised: Traceback (most recent call last): File "./qtplaskin/main.py", line 633, in export_data .savedata(fname, self.location) File "./qtplaskin/mplwidget.py", line 233, in savedata with open(fname, "w") as fout: TypeError: expected str, bytes or os.PathLike object, not tuple

QtWidgets.QFileDialog.getSaveFileName returns tuple, where filename is the first element I found the following solution: https://stackoverflow.com/questions/43509220/qtwidgets-qfiledialog-getopenfilename-returns-a-tuple

UPD: Found two more instances of the same bug. I suggest, the way I used to unpack the first element of the tuple is more robust in case the function will return more than 2 elements in future . This syntax should work with all versions of Python 3 https://www.python.org/dev/peps/pep-3132/

codecov[bot] commented 5 years ago

Codecov Report

Merging #5 into master will not change coverage. The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #5   +/-   ##
=======================================
  Coverage   20.83%   20.83%           
=======================================
  Files          16       16           
  Lines        1704     1704           
=======================================
  Hits          355      355           
  Misses       1349     1349
Impacted Files Coverage Δ
qtplaskin/main.py 19.95% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 82ba02a...6eed2f9. Read the comment docs.

erwanp commented 5 years ago

Hi ! I'm merging that ASAP. As I'm not actively maintening the package at the moment, do you want collaborator access to the project so you can push it yourself?

Edit: just did.