The ArcGIS for Desktop style file (.style) assists in organizing symbols and existing legend items in a map layer. The Legend item stores information about the legend and defines how a layer appears in a legend. If running the arcpy.mapping.ListStyleItems function in a 64-bit Python integrated development environment (IDE), it may fail with the following error.
IOError: Cannot find style called 'Esri.style'. Make sure the style file exists.
The following are possible causes for this issue.
- The ArcGIS for Desktop style file (.style) cannot be loaded in 64-bit applications. Style files (.style) created in ArcGIS for Desktop are 32-bit, which causes this conflict.
- Having both ArcGIS for Desktop (32-bit) and ArcGIS for Server (64-bit) versions of Python installed on the same machine can cause conflicts when running Python scripts. The Microsoft Windows operating system is associating Python (.py) files with the last installed version of Python, by default. For example, if ArcGIS for Desktop (32-bit) is installed first, followed by ArcGIS for Server (64-bit), the Python (.py) file is associated with the ArcGIS for Server 64-bit version.
- The ArcGIS for Desktop Background Geoprocessing (64-bit) patch is installed and running. ArcGIS for Desktop honors the patch and opens Python files in a 64-bit environment. This can cause conflicts when the Python script is run in 32-bit.
Solution or Workaround
The following are possible workarounds for this issue.
- Use a 32-bit Python IDE to run the Python scripts, and run the arcpy.mapping.ListStyleItems function from a 32-bit Python IDE. ArcGIS for Desktop provides 32-bit and 64-bit IDEs. The 32-bit version can be located at C:\Python27\ArcGIS10.x\Lib\idlelib\idle.bat, and the 64-bit version can be found at C:\Python27\ArcGISx6410.x\Lib\idlelib\idle.bat.
- Uninstall ArcGIS for Desktop Background Geoprocessing (64-bit) patch. This returns ArcGIS for Desktop to 32-bit background processing. The following ArcGIS for Desktop document describes this in detail: Background Geoprocessing (64-bit).
- Convert an ArcGIS for Desktop style file (.style) to an ArcGIS for Server style file (.serverstyle). Use the Make Server Style Sets tool to perform the conversion.
- Navigate to the following path, C:\Program Files (x86)\ArcGIS\Desktop10.x\bin, and locate the Make Server Style Set tool.
- Open the Make Server Style Set tool.
- Click Select... to open and browse for the folder containing the .style file to be converted.
- Click Make to convert the ArcGIS for Desktop style file (.style) to an ArcGIS for Server style file (.ServerStyle).