This project has moved and is read-only. For the latest updates, please go here.

Intellisense for OGR

Feb 6, 2014 at 11:13 AM

I am using gdal/ogr libraries but couldn't make the intellisense and auto-completion to work much deeper. Actually, it works on the first stage like creating an object, but no more intellisense when using that object to access its methods/properties. Example:
from osgeo import ogr
driver = ogr.GetDriverByName('ESRI Shapefile')
dataSource = driver.
Many thanks!
Feb 6, 2014 at 5:17 PM
This looks like a bug, since ogr has enough information that we should be able to figure this out. I'll file an issue.

As a workaround, if you add assert isinstance(driver, ogr.Driver) immediately after the assignment then we will be able to give you full completions.
Feb 6, 2014 at 5:21 PM
If you don't like the idea of having your program assert here, then you can use one of the following styles (which we still understand, but the assert will never be raised while you are running):
if False:
    assert isinstance(driver, ogr.Driver)
assert True or isinstance(driver, ogr.Driver)
Or you can make a helper function if you are calling this a lot:
def GetDriverByName(*args):
    from osgeo import ogr
    driver = ogr.GetDriverByName(*args)
    if False:
        assert isinstance(driver, ogr.Driver)
    return driver
Feb 6, 2014 at 5:25 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.