Ogs6py method not recognized

Hi,
When replicating an exemple using ogs6py, I get the following issue:

First I have created an OGS model instance, and tried to define a geometry typing:
from ogs6py.ogs import OGS
model = OGS(PROJECT_FILE=“thm_test.prj”, OMP_NUM_THREADS=4)
model.geo.add_geom(filename=“square_1x1_thm.gml”)

However I get the following error message:
AttributeError: ‘GEO’ object has no attribute ‘add_geom’

It’s as if the method add_geom was considered to be an attribute.

Has someone already encountered this kind of pb? Do you know how to overcome it?

Thanks for your tips

Hi @Bertrand which version are you using? The interface has changed a little bit over time. The example above uses the current naming convetion. If you are using the version from the ogs third party folder than the version might be too old (however, there should exist some example files in that directory as well with the old naming convetion). I recommend to install the current version either over github or via pip. just a disclaimer: ogs6py is not full-featured for building up entire input files from scratch. However, it works quite well for altering stuff in already existing input files and executing them. Examples and documentation for both methods are on the github page.
Another tip: code completion should show you all available methods.

Hi Joerg,
The version of ogs6py that I have installed is 0.31, whereas the OGS file that I have installed is ogs-6.4.0-8-g7530c9f1174-dirty-Windows-10.0.14393-python-3.7.2-utils
I take note of your comment about ogs6py being more suitable at modifying rather than creating an ogs project from scratch.

With this version, the above command should work.
How about the examples in the examples directory? Do they also not work?
I still think there is something mixed up with the installation. There shouldn’t be a ‘GEO’ object with all caps.
If model.geo.addGeom(filename=“square_1x1_thm.gml”) works instead of the above command, it confirms that you have an old version installed.
I have no idea how it works on windows, however, often user installations with pip override system installations. Usually, you see in the error message which path is used, and you can check whether this path contains the correct installation. This can be also mixed up if you have different python versions installed.

it works with the old version…I guess something went wrong in the installation process. I’ll proceed with a new installation.
Thanks for your help