Opened 6 years ago
Last modified 5 years ago
#3833 new defect
pygrass.gis.region.Region + WIND_OVERRIDE + non-existing path kills the process
Reported by: | pmav99 | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.8.3 |
Component: | PyGRASS | Version: | unspecified |
Keywords: | Cc: | ||
CPU: | Unspecified | Platform: | Unspecified |
Description
If you define WIND_OVERRIDE
to a non existing path, then, instantiating a Region
object results in a fatal error which kills the current process. This is a problem if you are e.g. in an interactive ipython session. Example:
import os from grass.pygrass.gis.region import Region os.environ["WIND_OVERRIDE"] = 'aaaa' r = Region() # results in a dead python process with the following message: # ERROR: Unable to open element file <windows> for <aaaa@PERMANENT>
The problem is that the Region.read()
method calls G_get_window
which calls G_get_element_window
, which calls G_fatal_window
if the file does not exist.
Adding a check for WIND_OVERRIDE
and the existence of the file in Region.read()
would solve the issue for most practical purposes, but would be subject to a race condition. Not sure what to suggest.
OK, the problem seems to be that the generated gis.py (i.e.
lib/python/ctypes/OBJ.x86_64-pc-linux-gnu/gis.py]
), doesn't defineerrcheck
for some of the functions, includingG_get_window
andG_get_element_window
. Can anyone provide a hint, why these functions don't haveerrcheck
defined while others do?Some relevant links: