AnsweredAssumed Answered

Unable to work with ECW images in Python Script?

Question asked by Playa on Aug 5, 2016
Latest reply on Aug 5, 2016 by Playa

I've writen a Python script that resamples ECW images and at the same time converts the tiles to TiFF images. When I try to run the following script I receive the following error message:


Processing COCT_W34A_23_8cm_2015 raster

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'GpMetadataFunctions, Version=, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86' or one of its dependencies. The system cannot find the file specified.
File name: 'GpMetadataFunctions, Version=, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at GetManagedType(Char* _assembly, Char* _path, Char* _className)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Error Message


Created on 05 Aug 2016

Resample and Convert

ECW images to TiFF

@author: PeterW
# import site packages and modules
import arcpy
from pathlib import Path

# set arguments
index_layer = r"E:\Projects\2016\G112502\lyr\SubcatchA.lyr"
output_folder = r"E:\Projects\2016\G112502\CoCT_Imagery\SubCatchA\Tiles"

# set environment variables
arcpy.env.overwriteOutput = True

# create single image from tiles based on index selection
def tiles_to_mosaic(index_layer, output_folder):
    with arcpy.da.SearchCursor(index_layer, ["RasterPath"]) as scur:  # @UndefinedVariable
        for row in scur:
            raster_name = Path(row[0]).stem
            arcpy.AddMessage("Processing {0} raster".format(raster_name))
            out_raster = "{0}\\{1}.tif".format(output_folder, raster_name)
            arcpy.Resample_management(row[0], out_raster, cell_size = 0.32, resampling_type = "NEAREST")

tiles_to_mosaic(index_layer, output_folder)

Python  Script


I've even go so far as to set the input arguments to a single ECW image and the output to the output TiFF image, yet I still receive the same error message. I'm able to run the Resample Tool from ArcMap or ArcCatalog with no error messages. I've tested the following on TiFF images and the script runs successfully.


Any advice in how to resolve the following will be appreciated.