robjameswall / dhitools

Python tools for working with DHI MIKE21
https://dhitools.readthedocs.io/en/latest/index.html
MIT License
24 stars 17 forks source link

help /// #5

Open zzme110 opened 5 years ago

zzme110 commented 5 years ago

An Error Has Occurred,when i ran this dode: dhitools/notebooks/dfs012_analysis.ipynb, and my version of python is 3.7. (anconda) Can u help me solve this error?,thanks error: File "C:\ProgramData\Anaconda3\lib\site-packages\dhitools\dfs.py", line 45, in dfs_info self.num_items = dfs_object.ItemInfo.Count AttributeError: 'list' object has no attribute 'Count'

famiuer commented 5 years ago

Which version of SDK do you install? Which line does this error occur? I think this error comes from the SDK dependency settings.

zzme110 commented 5 years ago

My sdk is 2019. I will check the mistake according to your suggestion tomorrow. My programming skills are poor. It took a long time and it was frustrating. Thank you for your help!

maximlt commented 5 years ago

Which version of pythonnet do you have?

zzme110 commented 5 years ago

pythonnet 2. 4.0

zzme110 commented 5 years ago

image

zzme110 commented 5 years ago

I can run the program now, but I don't fully understand the principle. This time I used conda install -c pythonnet instead of pip install pythonnet and then it worked. I just wonder why conda install -c pythonnet pythonnet must be used.

maximlt commented 5 years ago

When you download pythonnet through the pythonnet channel, you get the 2.3 version, while you get the 2.4 version with pip. Different versions, hence different behaviours apparently, that's why your code broke. If you prefer to use conda, you could download pythonnet on the conda-forge channel (conda install -c conda-forge pythonnet)

zzme110 commented 5 years ago

Thank you ! and i want to know how can i get the information of sdk's methods or functions ? Because I want to make some other tools.

maximlt commented 5 years ago

Here are a few useful links: http://doc.mikepoweredbydhi.help/webhelp/2017/DHI_DFS/html/N_.htm http://doc.mikepoweredbydhi.help/webhelp/2017/DHI_PFS/html/N_DHI_PFS.htm http://doc.mikepoweredbydhi.help/webhelp/2017/DHI_Projections/html/N_DHI_Projections.htm https://github.com/DHI

zzme110 commented 5 years ago

The mistake happened again, After my test, the attribute of iteminfo cannot be explained, The pythonnet 2.4.0 has been installed and other uninstalled. I used the anconda running it . I retested it on a different computer and got the same result

zzme110 commented 5 years ago

I found the answer that 2.4 version leads this error.