I am learning how to convert a script written in Python 2.7 for ArcGIS Desktop 10.5 to Python 3.x so that it is compatible with ArcGIS Pro 2.3.
I used Analyze Tools For Pro to check the existing script and it seemed to fail at import StringIO so I changed it to
from io import StringIO. Now it passes Analyze Tools for Pro but when I run the script in Pro I get the following error:
File "<string>", line 166
layer.visible = True
TabError: inconsistent use of tabs and spaces in indentation
I've tried manually fixing all of the tabs in IDLE and then saving the document, however when I reopen the "script" under the toolbox in ArcMap PRO, and it opens in IDLE, the tabs are back to five spaces.
#-------------Structures Map---------------| arcpy.AddMessage("Generating structures map...") newLyr = arcpy.mapping.ListLayers(mxd, "Subject Property", df) arcpy.mapping.MoveLayer(df, parcels, newLyr, "AFTER") #set the drawing order layers = arcpy.mapping.ListLayers(mxd, "", df) for layer in layers: layer.visible = False if layer.name in visibleStructuresLayers: layer.visible = True