MapInfo Pro Developers User Group

 View Only

Best way to interact with a MapInfo COM object in python?

  • 1.  Best way to interact with a MapInfo COM object in python?

    Posted 05-11-2021 12:11
    We have a function that we use to retrieve tables names like this :

    def getTableName(tablePath):
    pro = win32com.client.Dispatch("MapInfo.Application.x64")
    tableName = pro.eval('PathToTableName$(\"' + tablePath + '\")')
    return tableName
    But we have a problem, each time we use the function a MapInfo Pro process starts in Windows background and won't close.

    I thought that the "pro" object was closing itself after use ?

    What is the best way to use MapBasic  methods like "PathToTableName$" , is there a way without using win32com ?

    Thanks !

    ------------------------------
    David Boucher
    Korem Geospatial Software & Data
    Quebec QC
    ------------------------------