This is a bug I cannot reproduce with simple code. I'm working with ubuntu 16.04 and gdal 2.2.3, in python3.
When I try to open a geojson with ogr in my programm:
src_ds = ogr.Open('/data/train/AOI_2_Vegas_Train/geojson/line/line_AOI_2_Vegas_img2389.geojson')
I get an error which is a segfault I guess:
Fatal Python error: PyThreadState_Get: no current thread Current thread 0x00007f2bb0fcd700 (most recent call first): File "/home/myhome/project/env/local/lib/python3.5/site-packages/osgeo/ogr.py", line 7923 in Open
but when I try it in the python console, or in a small script, it works. I extracted the part of my code leading to this bug, but when I execute it separately from the rest of my code it works:
import gdal import ogr rgb_fn = '/data/train/AOI_2_Vegas_Train/RGB-PanSharpen/RGB-PanSharpen_AOI_2_Vegas_img2389.tif' rgb_ds = gdal.Open(rgb_fn, gdal.GA_ReadOnly) driver = gdal.GetDriverByName('GTiff') def _get_raster_properties(raster_ds): # get reference properties x_size = raster_ds.RasterXSize y_size = raster_ds.RasterYSize geotransform = raster_ds.GetGeoTransform() projection = raster_ds.GetProjection() return x_size, y_size, geotransform, projection x_size, y_size, geotransform, projection = _get_raster_properties(rgb_ds) line_ds = driver.Create('/tmp/line_ds.tif', x_size, y_size, 1, gdal.GDT_Byte) line_ds.SetGeoTransform(geotransform) line_ds.SetProjection(projection) line_fn = '/data/train/AOI_2_Vegas_Train/geojson/line/line_AOI_2_Vegas_img2389.geojson' src_ds = ogr.Open(line_fn) # this is failing in my code, but not here gdal.RasterizeLayer(line_ds, , src_ds.GetLayer(), burn_values=)
this script is the equivalent of the code I am runnig in my program, with the same file treated.
Is this a gdal bug?