Using ArcObjects for ArcMap 10.8 in Python

363
0
01-26-2023 06:36 PM
RichardFairhurst
MVP Honored Contributor

I have been trying to use code to call ArcObjects for ArcMap 10.8 from within Python based on various code examples on the web and so far all of them aren't working.  So, is it possible to use ArcObjects for ArcMap 10.8 within Python, or does that only work for earlier versions of ArcMap?

I have tried installing comtypes and using the first example from this website: https://gist.github.com/AlexArcPy/bf0f1702d6b0d3840f43442a2d5ef5c6

However, although I have changed the path to match my version of ArcMap, the code fails on the line 12 with a "WindowsError: [Error -2147024809] The parameter is incorrect" error when it tries to execute:

esriFramework = GetModule(r"C:\Program Files (x86)\ArcGIS\Desktop10.8\com\esriFramework.olb")

 

I also tried using the library on NuGet called UnmanagedExports from Robert Giesecke from https://www.udcus.com/blog/2017/06/27/extending-arcpy-increased-capabilities-arcobjects-and-c

However that code fails when I try to run the Python Example Call Function saying that the dll I built does not have a function called "CustomPost" and doesn't even try to execute anything from the dll.  I had made sure the x86 build type is selected in the Target Platform of my project properties.  I read elsewhere that the UnmanagedExports library is not compatible with Visual Studio 2017, which is the minimum version required by the ArcMap 10.8 SDK.

So, is it no longer possible to call ArcObjects for ArcMap 10.8 from within Python?

 

Tags (2)
0 Kudos
0 Replies