addon works on command line but not in Python console

Hi, I am trying to use the r.mess addon in grass gis (8.4 and 8.5.0dev). From the command line it works fine.

r.mess env=bio_1,bio_2 output=test_01
 100%
 100%
 100%
 100%
Finished ...

However, when running exactly the same from the Python console, I get an error

gs.run_command("r.mess", env="bio_1,bio_2", output="test_02")

Traceback (most recent call last):
  File "/usr/lib/python3.12/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/usr/lib/grass84/etc/python/grass/script/core.py", line 476, in run_command
    ps = start_command(*args, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/grass84/etc/python/grass/script/core.py", line 431, in start_command
    return Popen(args, **popts)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/grass84/etc/python/grass/script/core.py", line 72, in __init__
    subprocess.Popen.__init__(self, args, **kwargs)
  File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.12/subprocess.py", line 1868, in _execute_child
    for k, v in env.items():
                ^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'

I can run other addons without problems, and I am totally at a loss what goes wrong here. Any ideas or hints on what to look for?

Don’t you have to send the 'env` parameter as a python list?

Thanks. Both should work I think. I tried, but no luck. However, I made some changes in the code, unrelated to this, and somehow that seems to have solved it.

Glad you found the prob.
:grinning:

The solution, still not sure what the problem was :wink::thinking: