dnvgl / qats

Python library and GUI for efficient processing and visualization of time series.
MIT License
38 stars 10 forks source link

GUI import error #119

Closed EBGlom closed 9 months ago

EBGlom commented 9 months ago

Describe the bug Pressing "Import from file" in the GUI causes error

To Reproduce Steps to reproduce the behavior:

  1. In GUI
  2. Go to File
  3. Click on "Import from File"

Expected behavior Import dialogue opens

Screenshots image

Desktop (please complete the following information):

Additional context PySide6 causes the error:

ValueError: <PySide6.QtWidgets.QFileDialog(0x2408de302e0) at 0x00000240974AF480> is not a valid QFileDialog.Option

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ebg.SEVAN\Code\qats\qats\app\gui.py", line 802, in on_import options = dlg.Options() File "C:\Users\ebg.SEVAN\Code\poetry_venv\qats-eJ8se3lo-py3.10\lib\site-packages\qtpy\QtWidgets.py", line 163, in QFileDialog.Options = lambda value=0: QFileDialog.Option(value) File "C:\Python3\3.10.11\lib\enum.py", line 385, in call return cls.new(cls, value) File "C:\Python3\3.10.11\lib\enum.py", line 718, in new raise exc File "C:\Python3\3.10.11\lib\enum.py", line 700, in new result = cls.missing(value) File "C:\Python3\3.10.11\lib\enum.py", line 844, in missing if value < 0: TypeError: '<' not supported between instances of 'PySide6.QtWidgets.QFileDialog' and 'int'

eneelo commented 9 months ago

Thanks for reporting! Two quick questions:

  1. When did you install? We released version 5.0.6 earlier today, which we expected to fix the dynamic versioning issue.
  2. Did you install in an clean python environment (e.g., a new venv) or in an existing one that has previously had qats version <5.0.0 installed? If the latter, could you please check installing in a fresh environment and report back?

Edit: The reported bug is not likely related to the second item above. Will look into this. A temporary workaround is to drop the files onto qats gui instead of opening the "Import from file" dialogue -- if possible.

EBGlom commented 9 months ago
  1. Today, and it still is the latest from the Master branch.
  2. Yes, I was on Python 3.7 before today
eneelo commented 9 months ago
  1. Installed from PyPi or using poetry install in a cloned repo?
EBGlom commented 9 months ago

poetry install

eneelo commented 9 months ago

And you have installed the poetry-dynamic-version-plugin as described in README.md?

poetry self add "poetry-dynamic-versioning[plugin]"

If yes, could you also check the poetry-core version? I believe poetry-core >= 1.0.0 is required.

eneelo commented 9 months ago

By the way, how did you extract the qats version? Long story short; qats --version (or in an interactive python session: qats.__version__) will currently always return the string "0.0.0" when in an editable install (e.g., from poetry install). This is due to how the dynamic versioning plugin works. On the other hand; if installed from a built distribution (e.g., from PyPi), it should always return the expected version string.

Edit: the original comment that stated that Help > About dialogue should show the correct version string is not correct (when in an editable install).

If dynamic versioning plugin works, the following python code should render the correct version string:

>>> from importlib import metadata
>>> print(metadata.version("qats"))
EBGlom commented 9 months ago

Ehm.. no :) But running that command crashed poetry on my computer.... I might have have old versions of poetry and poetry-core.

I used qats --version, but the GUI also returned version 0.0.0 image But all of this is without poetry-dynamic-versioning

eneelo commented 9 months ago

But all of this is without poetry-dynamic-versioning

The metadata.version("qats") will only work if poetry-dynamic-versioning is installed at the time when poetry install is executed

eneelo commented 9 months ago

@EBGlom PR #121 fixes a proper version string, even after poetry install. Provided that the dynamic versioning plugin is properly installed, that is. Will be merged to master very soon.

EBGlom commented 9 months ago

Just a final update: It took until now to re-install poetry and PyCharm(!) to get poetry working in PyCharm again. Maybe the readme should be update with a warning to ensure that poetry is up to date before installing the dynamic versioning plugin.

With the plugin, the version is no longer 0.0.0, btw.