laptop and a wrench

Bug

Using Python to run the Add Rasters To Mosaic Dataset tool with the NITF raster type does not parse correct values when executed outside of ArcGIS Pro, such as the Python window.

Last Published: December 27, 2022 ArcGIS Pro
Bug ID Number BUG-000153681
SubmittedNovember 14, 2022
Last ModifiedJune 5, 2024
Applies toArcGIS Pro
Version found2.9
Operating SystemWindows OS
Operating System Version10.0 64 Bit
Version Fixed3.2
StatusFixed

Additional Information

This issue is fixed in ArcGIS Pro 3.2.0. Use the ctypes workaround in ArcGIS Pro versions 3.1 and earlier.

Workaround

In ArcGIS Pro 3.0, add the following lines to force Python to init the plugin manager to allow the Add function to work correctly:

import arcpy from pathlib import Path # Workaround for missing init of Add-Ins in Python from ctypes import * hDADFLib = cdll.LoadLibrary(rcpy.GetInstallInfo()['InstallDir'] + r"bin\DADFLib.dll") hDADFLib.InitializeAddInManager.argtypes = [ c_void_p, c_wchar_p ] hDADFLib.IntiializeAddInManager.restype = c_int result = hDADFLib.InitializeAddInManager(0, "en_us")

mydir = Path(__file__).parent.absolute()

arcpy.management.AddRastersToMosaicDataset(str(mydir /r"test_md.gdb\ingest_test"), "NITF", r"'C:\data-local\test_images\'", "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", "NO_OVERVIEWS", None, 0, 1500, None, "*.NTF;*.NITF;*.NSF;*.NSIF;*.r0;*.bif", "SUBFOLDERS", "ALLOW_DUPLICATES", "NO_PYRAMIDS", "NO_STATISTICS", "NO_THUMBNAILS", "", "NO_FORCE_SPATIAL_REFERENCE", "NO_STATISTICS", None, "NO_PIXEL_CACHE", r"C:\Users\dan2120\AppData\Local\ESRI\rasterproxies\test_py_add_rasters")

Steps to Reproduce

Bug ID: BUG-000153681

Software:

  • ArcGIS Pro

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options