TUFLOW-Support / QGIS-TUFLOW-Plugin

TUFLOW related QGIS Plugins
9 stars 7 forks source link

TypeError: PurePath._from_parts() got an unexpected keyword argument 'init' #34

Closed ZedeN1 closed 1 year ago

ZedeN1 commented 1 year ago

When trying to open a TCF file CCW_v02-B_d~e1~px~e2~.tcf keep getting an error TypeError: PurePath._from_parts() got an unexpected keyword argument 'init'

Python error:

An error has occurred while executing Python code: 

TypeError: PurePath._from_parts() got an unexpected keyword argument 'init' 
Traceback (most recent call last):
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_menu.py", line 783, in loadTuflowLayersFromTCF
    getScenariosFromTCF_v2(inFileName, scenarios)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_library.py", line 3147, in getScenariosFromTCF_v2
    control_file = TuflowPath(control_file)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format/helpers/file.py", line 234, in __new__
    self = cls._from_parts(args, init=False)
TypeError: PurePath._from_parts() got an unexpected keyword argument 'init'

Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] 
QGIS version: 3.28.1-Firenze Firenze, fde3b8fbb8 

Python Path:
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/stationlines
/usr/share/qgis/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/pavel/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/usr/lib/python3.10/dist-packages
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/forms
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer
/tmp/tuflow_refh28ihfe13n
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs
C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/alg
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/SwapVectorDirection
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format

System Details:

LSB Version:    core-11.1.0ubuntu4-noarch:printing-11.1.0ubuntu4-noarch:security-11.1.0ubuntu4-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

QGIS version
3.28.1-Firenze
QGIS code revision
fde3b8fbb8
Qt version
5.15.3
Python version
3.10.6
GDAL/OGR version
3.4.1
PROJ version
8.2.1
EPSG Registry database version
v10.041 (2021-12-03)
GEOS version
3.10.2-CAPI-1.16.0
SQLite version
3.37.2
PDAL version
2.3.0
PostgreSQL client version
unknown
SpatiaLite version
5.0.1
QWT version
6.1.4
QScintilla2 version
2.11.6
OS version
Ubuntu 22.04.1 LTS

Active Python plugins
tuflow
3.6
TUFLOW-Support commented 1 year ago

Hi, hopefully a fix for this is already available in the latest dev version which can be downloaded from the following link: https://downloads.tuflow.com/Private_Download/QGIS_TUFLOW_Plugin/tuflow.3.6.0.51.zip

It can be installed using 'Install From ZIP' in the plugin manager. The repo will be updated once the next plugin release is formalised.

Please let me know if it fixes the issue.

ZedeN1 commented 1 year ago

Hi, it fixed that error but now there is a different one:

An error has occurred while executing Python code: 

AttributeError: 'PosixPath' object has no attribute 'find_parent' 
Traceback (most recent call last):
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/tuflowqgis_menu.py", line 817, in loadTuflowLayersFromTCF
    getScenariosFromTCF_v2(inFileName, scenarios)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/tuflowqgis_library.py", line 3163, in getScenariosFromTCF_v2
    settings_ = ConvertSettings(*['-tcf', control_file])
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/convert_tuflow_model_gis_format/helpers/settings.py", line 81, in __init__
    self.root_folder = self._guess_root_folder()
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/convert_tuflow_model_gis_format/helpers/settings.py", line 213, in _guess_root_folder
    root = self.tcf.find_parent('TUFLOW', 5)
AttributeError: 'PosixPath' object has no attribute 'find_parent'

Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] 
QGIS version: 3.28.1-Firenze Firenze, fde3b8fbb8 

Python Path:
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/stationlines
/usr/share/qgis/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/pavel/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/usr/lib/python3.10/dist-packages
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/forms
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/tuflowqgis_tuviewer
/tmp/tuflow_refh23c78zm11
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs
C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/alg
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/SwapVectorDirection
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/Pavel-EVY/python/plugins/tuflow/convert_tuflow_model_gis_format
TUFLOW Plugin Version   : 3.6.0.51
QGIS Version        : 3.28.1-Firenze
Python Version      : 3.10.6

---edit--- Sorry accidentally closed the issue!

TUFLOW-Support commented 1 year ago

Ok, can you please try again?

TUFLOW-Support commented 1 year ago

Sorry, I should add that the repository has been updated, please try pulling the latest

ZedeN1 commented 1 year ago

I just cloned the master and get a different error:

An error has occurred while executing Python code: 

ModuleNotFoundError: No module named 'tuflow.convert_tuflow_model_gis_format.helpers' 
Traceback (most recent call last):
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_menu.py", line 817, in loadTuflowLayersFromTCF
    getScenariosFromTCF_v2(inFileName, scenarios)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_library.py", line 3168, in getScenariosFromTCF_v2
    from .convert_tuflow_model_gis_format.helpers.control_file import get_commands
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'tuflow.convert_tuflow_model_gis_format.helpers'

Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] 
QGIS version: 3.28.1-Firenze Firenze, fde3b8fbb8 

Python Path:
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/stationlines
/usr/share/qgis/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/pavel/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/usr/lib/python3.10/dist-packages
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/forms
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs
C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/alg
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/SwapVectorDirection
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
TUFLOW Plugin Version   : 3.7
QGIS Version        : 3.28.1-Firenze
Python Version      : 3.10.6
TUFLOW-Support commented 1 year ago

Maybe try this: https://downloads.tuflow.com/Private_Download/QGIS_TUFLOW_Plugin/tuflow.3.7.0.1.zip

ZedeN1 commented 1 year ago
An error has occurred while executing Python code: 

TypeError: Path.glob() takes 2 positional arguments but 3 were given 
Traceback (most recent call last):
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_menu.py", line 817, in loadTuflowLayersFromTCF
    getScenariosFromTCF_v2(inFileName, scenarios)
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_library.py", line 3184, in getScenariosFromTCF_v2
    for file in command.iter_files(settings_):
  File "/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format/helpers/control_file.py", line 171, in iter_files
    for file in settings.control_file.parent.glob(rel_path, settings.wildcards):
TypeError: Path.glob() takes 2 positional arguments but 3 were given

Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] 
QGIS version: 3.28.2-Firenze Firenze, b47e00ba60 

Python Path:
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/stationlines
/usr/share/qgis/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/pavel/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/usr/lib/python3.10/dist-packages
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/forms
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/tuflowqgis_tuviewer
/tmp/tuflow_refh2v1iwqg5m
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow
C:\Program Files\JetBrains\PyCharm 2020.3.1\debug-eggs
C:\Program Files\JetBrains\PyCharm 2020.3.1\plugins\python\helpers\pydev
C:\Program Files\JetBrains\PyCharm 2019.1.3\debug-eggs
C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/alg
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/SwapVectorDirection
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
/home/pavel/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/convert_tuflow_model_gis_format
TUFLOW Plugin Version   : 3.7.0.1
QGIS Version        : 3.28.2-Firenze
Python Version      : 3.10.6
TUFLOW-Support commented 1 year ago

I bit the bullet and installed a linux environment. Hopefully finally fixed! https://downloads.tuflow.com/Private_Download/QGIS_TUFLOW_Plugin/tuflow.3.7.0.2.zip

ZedeN1 commented 1 year ago

Thank you! Works great now!