この非常に短いスクリプトを Ubuntu で実行すると、segfault が発生します。
from osgeo import ogr, osr
shpfile = 'Census_County_TIGER00_IN.shp'
def cust_field(field):
'''cust_field(shpfile, field) creates a field definition, which, by calling cust_field(), can be used to create a field using the CreateField() function.
cust_field() DOES NOT create a field -- it simply creates a "model" for a field, that can then be called later. It's weird, but that's GDAL/OGR, as far as I can tell.'''
fieldDefn = ogr.FieldDefn(field, ogr.OFTInteger)
fieldDefn.SetWidth(14)
fieldDefn.SetPrecision(6)
return fieldDefn
ds = ogr.Open(shpfile, 1)
lyr = ds.GetLayerByIndex(0)
field = cust_field("Test")
lyr.CreateField(field)
iPython、通常のシェルPython、およびIDLEコマンドラインがすべてセグメンテーション違反にダンプする最後の行まで、すべてがスムーズに実行されます。これは私の側のエラーですか、それとも根本的な C の問題であり、適切に対処していませんか?