I build a new true Type Font and I will check the names
It isn't your version, I just ran the following on an ArcGIS 10.1 (build 3143) install:
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="keyword token">import</SPAN> os <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> style_dir <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>arcpy<SPAN class="punctuation token">.</SPAN>GetInstallInfo<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'InstallDir'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Styles'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> style_file <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>style_dir<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'ESRI.style'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> style_folder <SPAN class="operator token">=</SPAN> <SPAN class="string token">'Marker Symbols'</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> styles <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListStyleItems<SPAN class="punctuation token">(</SPAN>style_file<SPAN class="punctuation token">,</SPAN> style_folder<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="keyword token">for</SPAN> style <SPAN class="keyword token">in</SPAN> styles<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> <SPAN class="keyword token">print</SPAN> style<SPAN class="punctuation token">.</SPAN>itemName <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> Circle <SPAN class="number token">1</SPAN> Square <SPAN class="number token">1</SPAN> Triangle <SPAN class="number token">1</SPAN> <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> Rnd Square <SPAN class="number token">6</SPAN> Rnd Square <SPAN class="number token">7</SPAN> Dam Lock <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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".
Glad you got it working. In order for others to know this thread is answered, please mark a response as correct.
It's work. thanks a lot Joshua
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 arcpystyle_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.pyTraceback (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", line1599, in ListStyleItems return convertArcObjectToPythonObject(arcgisscripting._listStyleItems(*gp_fixargs([style_file_path, style_folder_name, wildcard], True, False)))IOError
This looks the wrong way round to me.
style_file = "C:\ArcGIS\Styles"style_folder = "MVV_Netrion_Bestand_Gas.style"
Thanks for your answer. I work with ArcGIS V10.1 and I created the following Python Skript:
import arcpystyle_file = "C:\ArcGIS\Styles"style_folder = "MVV_Netrion_Bestand_Gas.style"
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", line1599, in ListStyleItems return convertArcObjectToPythonObject(arcgisscripting._listStyleItems(*gp_fixargs([style_file_path, style_folder_name, wildcard], True, False)))ValueError: StyleGalleryObject: Input value is not valid
Whats the problem?
Does this work for you:
style_file <SPAN class="operator token">=</SPAN> <SPAN class="comment token"># path to style file</SPAN> style_folder <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Marker Symbols"</SPAN> styles <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListStyleItems<SPAN class="punctuation token">(</SPAN>style_file<SPAN class="punctuation token">,</SPAN> style_folder<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> style <SPAN class="keyword token">in</SPAN> styles<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN> style<SPAN class="punctuation token">.</SPAN>itemName<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.