Opened 7 years ago

Last modified 7 years ago

#7094 closed defect

Can't open MITAB with missing IND file in Python — at Version 1

Reported by: cdestigter Owned by: hobu
Priority: normal Milestone: 2.2.3
Component: PythonBindings Version: 2.2.2
Severity: normal Keywords:
Cc:

Description (last modified by cdestigter)

We have been provided a TAB which is admittedly slightly broken. It has no IND file, but the field listing in the TAB suggests it should (because some fields are indexed.)

ogrinfo happily reads the file with a warning, and QGIS is happy to read it somehow. However, opening the file via the Python bindings doesn't work:

>>> gdal.UseExceptions()

>>> gdal.GetUseExceptions()
1

>>> x = gdal.OpenEx('broken.tab', gdal.OF_VERBOSE_ERROR)
CPLError: Open() failed for broken.ind (rb)
CPLError: Failed to open index file broken.IND.
GDAL: GDALOpen(broken.tab, this=0x213a680) succeeds as MapInfo File.
GDAL: GDALClose(broken.tab, this=0x213a680)

>>> x is None
True

Note that not only did the open fail, but no exception was thrown, despite setting the right flags.

However, ogrinfo seems happy to read the file correctly:

$ ogrinfo -so -ro -al broken.tab
GNM: GNMRegisterAllInternal
GNM: RegisterGNMFile
GNM: RegisterGNMdatabase
CPLError: Open() failed for broken.ind (rb)
ERROR 3: Open() failed for broken.ind (rb)
CPLError: Failed to open index file broken.IND.
ERROR 4: Failed to open index file broken.IND.
GDAL: GDALOpen(broken.tab, this=0xec6bb0) succeeds as MapInfo File.
INFO: Open of `broken.tab'
      using driver `MapInfo File' successful.
OGR: GetLayerCount() = 1


Layer name: broken
Geometry: Point
Feature Count: 76
Extent: (-0.905866, 0.293315) - (0.100955, 0.907231)
Layer SRS WKT:
GEOGCS["unnamed",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563],
        TOWGS84[0,0,0,0,0,0,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
FID: Integer (0.0)
GDAL: GDALClose(broken.tab, this=0xec6bb0)
GDAL: In GDALDestroy - unloading GDAL shared library.

This is with a slightly-custom GDAL 2.2.x.

Change History (2)

by cdestigter, 7 years ago

Attachment: broken.zip added

comment:1 by cdestigter, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.