-
-
Notifications
You must be signed in to change notification settings - Fork 295
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] Temporal Framework Python interface does not take into account changes of mapset #629
Comments
|
Hi @lrntct , |
|
@zarch I do not know much of the internals of the temporal framework, but it seems that it sets several global variables at invocation: grass/lib/python/temporal/core.py Lines 130 to 134 in 5ae98b8
Maybe some of them are not properly cleaned up or reset when changing the mapset? |
|
@zarch Running them in a subprocess should fix it because the init is done again. @lrntct A reasonable workaround seems to be using the modules (through grass.script or grass.pygrass) rather than the functions. This would be more natural in GRASS context and likely more convenient than managing that through subprocesses manually. That's not to say that the current library behavior is great, okayish perhaps. |
|
@wenzeslaus I understand that the GRASS scripting library runs each command in a subprocess. |
|
@lrntct I agree. That's why I'm saying it's a workaround. Just based on your note about the current implementation: The global state in the library is not very Pythonic either which is the root of the issue. Perhaps useful as a default, but some different approach is needed like an way to create a new, different object for the connection to be more flexible in what can be done. |
|
@wenzeslaus I wonder if encapsulating those functions and variables in a class could be possible, because it might help solve the issue. It would be a major refactor because those global variables are almost everywhere in core.py. It would be interesting to have the opinion of Sören on the matter, if he's still around. |
|
Yes, that's a path I would try to go. Some kind of session, connection object or environment passed around to the functions (or providing the functions directly) and the functions possibly defaulting to whatever is the current/global environment (although that could be more danger than it is worth). Something similar is now possible for some functions in |
Describe the bug
When changing the mapset inside a Python script, the temporal framework does not take this change into account and fail to connect to the temporal database, even thought GRASS reports the new mapset as being accessible.
To Reproduce
Output:
Expected behavior
I would expect the GRASS temporal framework to take into account the changes of the current mapset. This could be circumvented by the use of subprocess, but it is not convenient.
System description (please complete the following information):
Additional context
Perhaps related:
https://trac.osgeo.org/grass/ticket/2110
https://trac.osgeo.org/grass/ticket/3668
The text was updated successfully, but these errors were encountered: