Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] r.mess runs on command line but not from Python console #1252

Closed
ecodiv opened this issue Nov 29, 2024 · 2 comments
Closed

[Bug] r.mess runs on command line but not from Python console #1252

ecodiv opened this issue Nov 29, 2024 · 2 comments
Labels
bug Something isn't working Python Related code is in Python

Comments

@ecodiv
Copy link
Contributor

ecodiv commented Nov 29, 2024

Name of the addon
r.mess

Describe the bug
The r.mess works when run from the command line. However, when run from the Python console, it throws an immediate error.

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'

To Reproduce
Steps to reproduce the behavior:

In the Python console, run e.g.,

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

Expected behavior
It should run, as it does on the command line, and generates the mess layers

System description (please complete the following information):

Operating System:
Ubuntu 24.04
GRASS GIS version: 8.4.0
date=2024
revision=exported
build_date=2024-07-29
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=8.4.0
libgis_date=2024-07-29T16:24:27+00:00
proj=9.4.1
gdal=3.9.1
geos=3.12.2
sqlite=3.45.1
Python=3.12.3

@ecodiv ecodiv added bug Something isn't working Python Related code is in Python labels Nov 29, 2024
@ecodiv ecodiv changed the title [Bug] [Bug] r.mess runs on command line but not from Python console Nov 29, 2024
@ecodiv
Copy link
Contributor Author

ecodiv commented Dec 1, 2024

Seems to be solved with #1253

@ecodiv
Copy link
Contributor Author

ecodiv commented Dec 2, 2024

Solved in #1253

@ecodiv ecodiv closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Related code is in Python
Projects
None yet
Development

No branches or pull requests

1 participant