DHI / mikecore-python

MIKE Core in Python
5 stars 0 forks source link

Creating a Dfs3 object fails #13

Closed watermain closed 3 years ago

watermain commented 3 years ago

mikeio version 0.7.0 (tried the pip-installed one and also the current state in main) No problem on 0.6.4. Tried with a dfs3 file from mshe output and also with one created in MZ shell, error is the same.

code to reproduce:


import mikeio
dfsPath = r"C:\Users\uha\Documents\MIKE Zero Projects\MIKE_SHE\Karup_Basic\Karup_basic.she - Result Files HOT\Karup_basic_3DUZ.dfs3"
dfs3File = mikeio.dfs3.Dfs3(dfsPath)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\uha\OneDrive - DHI\DHIGitHub\mikeio\mikeio\dfs3.py", line 20, in __init__
    self._read_dfs3_header()
  File "C:\Users\uha\OneDrive - DHI\DHIGitHub\mikeio\mikeio\dfs3.py", line 41, in _read_dfs3_header
    self._dfs = DfsFileFactory.Dfs3FileOpen(self._filename)
  File "C:\Program Files\Python37\lib\site-packages\mikecore\DfsFileFactory.py", line 49, in Dfs3FileOpen
    dfs.Open(filename, DfsFileMode.Read, parameters);
  File "C:\Program Files\Python37\lib\site-packages\mikecore\Dfs123File.py", line 10, in Open
    super().Open(filename, mode, parameters)
  File "C:\Program Files\Python37\lib\site-packages\mikecore\DfsFile.py", line 661, in Open
    self.FileInfo.InitRead(self, self.headPointer, parameters)
  File "C:\Program Files\Python37\lib\site-packages\mikecore\DfsFile.py", line 549, in InitRead
    self.zKey.ctypes.data,
ctypes.ArgumentError: argument 2: <class 'OverflowError'>: int too long to convert
jsmariegaard commented 3 years ago

@watermain can you confirm that the problem has been fixed and it works for you using mikeio 0.7.2? Thanks

watermain commented 3 years ago

Hi Jespers, works when installing the mikecore dev version! thanks - Uwe

jsmariegaard commented 3 years ago

Hi Uwe, I have now added mikecore>=0.1.2 to MIKE IO requirements. Hence it should now also work if you update MIKE IO :-)