I build a new true Type Font and I will check the names
Solved! Go to Solution.
It isn't your version, I just ran the following on an ArcGIS 10.1 (build 3143) install:
>>> import os
>>>
>>> style_dir = os.path.join(arcpy.GetInstallInfo()['InstallDir'], 'Styles')
>>> style_file = os.path.join(style_dir, 'ESRI.style')
>>> style_folder = 'Marker Symbols'
>>>
>>> styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
>>> for style in styles:
... print style.itemName
...
Circle 1
Square 1
Triangle 1
...
Rnd Square 6
Rnd Square 7
Dam Lock
>>>
Please review the documentation. The style folder name you need to pass isn't a directory on the file system, it is the name of the style folder in the style file itself that you want to get information about. In this case, with marker symbols, it needs to be "Marker Symbols". If you were interested in colors, it would be "Colors".
Does this work for you:
style_file = # path to style file
style_folder = "Marker Symbols"
styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
for style in styles:
print style.itemName
Thanks for your answer. I work with ArcGIS V10.1 and I created the following Python Skript:
import arcpy
style_file = "C:\ArcGIS\Styles"
style_folder = "MVV_Netrion_Bestand_Gas.style"
styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
for style in styles:
print style.itemName
I get the following errors:
Traceback (most recent call last):
File "C:\ArcGIS\python\read_style.py", line 6, in <module>
styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\mapping.py", line
1599, in ListStyleItems
return convertArcObjectToPythonObject(arcgisscripting._listStyleItems(*gp_fi
xargs([style_file_path, style_folder_name, wildcard], True, False)))
ValueError: StyleGalleryObject: Input value is not valid
Whats the problem?
This looks the wrong way round to me.
style_file = "C:\ArcGIS\Styles"
style_folder = "MVV_Netrion_Bestand_Gas.style"
oh sorry, but it doesn work. Ich think its the wrong ArcPY Version. I work with ArcGIS V10.1.
# C:\Python27\ArcGIS10.1\python.exe C:\ArcGIS\python\read_style.py
import arcpy
style_folder = "C:\ArcGIS\Styles"
style_file = "MVV_Netrion_Bestand_Gas.style"
styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
for style in styles:
print style.itemName
C:\Users\u2267>C:\Python27\ArcGIS10.1\python.exe C:\ArcGIS\python\read_style.py
Traceback (most recent call last):
File "C:\ArcGIS\python\read_style.py", line 7, in <module>
styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\mapping.py", line
1599, in ListStyleItems
return convertArcObjectToPythonObject(arcgisscripting._listStyleItems(*gp_fixargs([style_file_path, style_folder_name, wildcard], True, False)))
IOError
style_file still needs to be a full path to the style file, including the filename itself.
It isn't your version, I just ran the following on an ArcGIS 10.1 (build 3143) install:
>>> import os
>>>
>>> style_dir = os.path.join(arcpy.GetInstallInfo()['InstallDir'], 'Styles')
>>> style_file = os.path.join(style_dir, 'ESRI.style')
>>> style_folder = 'Marker Symbols'
>>>
>>> styles = arcpy.mapping.ListStyleItems(style_file, style_folder)
>>> for style in styles:
... print style.itemName
...
Circle 1
Square 1
Triangle 1
...
Rnd Square 6
Rnd Square 7
Dam Lock
>>>
Please review the documentation. The style folder name you need to pass isn't a directory on the file system, it is the name of the style folder in the style file itself that you want to get information about. In this case, with marker symbols, it needs to be "Marker Symbols". If you were interested in colors, it would be "Colors".
It's work. thanks a lot Joshua
Glad you got it working. In order for others to know this thread is answered, please mark a response as correct.