EsriOceans / btm

Benthic Terrain Modeler
http://resources.arcgis.com/en/communities/oceans/
Mozilla Public License 2.0
26 stars 7 forks source link

Arc-Chord Ratio is using reload() from Python 2 #138

Closed ryanjshields closed 1 year ago

ryanjshields commented 1 year ago

If you attempt to run Arc-Chord Ratio from the toolbox in ArcGIS Pro 3.0.1 and get NameError: name 'reload' is not defined it's because reload was built in to Python 2 but not Python 3. That section of the script would need to be updated to something like this:

def execute(self, parameters, messages):
        import importlib
        # run related python script with selected input parameters
        from scripts import acr
        importlib.reload(acr)
        acr.main(
            in_raster=parameters[0].valueAsText,
            areaOfInterest=parameters[1].valueAsText,
            saveTINs=parameters[2].valueAsText,
            out_workspace=parameters[3].valueAsText)
scdub commented 1 year ago

@ryanjshields Thanks for the report! It looks like this was a debugging statement which made it into the release but isn't present in the repo. I've uploaded a new version with the reload statement removed. It isn't necessary for execution, only useful when debugging the code.

ryanjshields commented 1 year ago

Thanks, Shaun! That's good to know! (I wasn't sure what its purpose was in the script so I just found a couple of StackExchange posts on replacing with importlib and went with that since it didn't seem to break it further)