<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Parsing csv data and updating a dictionary in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/parsing-csv-data-and-updating-a-dictionary/m-p/681011#M52767</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple house keeping items:&amp;nbsp; I suggest you get into the habit of using the syntax highlighter.&amp;nbsp; You can find it by clicking the three dots to expand the menu, click more, syntax highlighter and finally select python.&amp;nbsp; It just makes reading your code much easier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have a huge try/except block, with little to go on if you get a failure.&amp;nbsp; You might want to break up you various steps into separate try/except blocks, something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcy&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; etc

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   first step of the process
   blah blah bla
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   second step of the process
   blah blah blah
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   etc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err

etc
etc
etc&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:40:22 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2021-12-12T04:40:22Z</dc:date>
    <item>
      <title>Parsing csv data and updating a dictionary</title>
      <link>https://community.esri.com/t5/python-questions/parsing-csv-data-and-updating-a-dictionary/m-p/681010#M52766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a little stuck on my code.&amp;nbsp; I am new to python and am learning as I go, but have usually been able to figure it out till now.&amp;nbsp; The code was working up till I put the dictionary part in and now this is where its failing.&amp;nbsp; When I run the program, it only goes through once and doesn't appear to be storing the data.&amp;nbsp; I have found people in the discussions have had the same problem, but they never said what helped them resolve the issue.&amp;nbsp; Below is a breakdown of the objective of the program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;The rhinos in the spreadsheet appear in no guaranteed order, and not all the rhinos appear at the beginning of the spreadsheet. As I parse each line, I must determine which rhino the reading belongs to and update that rhino's polyline track accordingly. I am not allowed to sort the Rhino column in Excel before I export to the CSV file. My script must be "smart" enough to work with an unsorted spreadsheet in the order that the records appear.&lt;/SPAN&gt;&lt;BR style="background-color: #ffffff;" /&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;I do not immediately know how many rhinos are in the file or even what their names are. Although I could visually comb the spreadsheet for this information and hard-code each rhino's name, your script is required to handle all the rhino names programmatically. The idea is that I should be able to run this script on a different file, possibly containing more rhinos, without having to make many manual adjustments.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;Sample Data:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px;"&gt;Observer,X,Y,Rhino,Comments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,26.99391,-19.10447,Bo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,27.00071,-19.1089,Tulip,Bathing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,26.9919,-19.10511,Bo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,27.00071,-19.1059,Tulip,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,26.96809,-19.09578,Patches,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,26.97808,-19.11016,Dinky,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,26.99213,-19.10395,Bo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="border: 0px;"&gt;Ben,27.00083,-19.10326,Tulip,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate any help and guidance anyone has to offer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;#Import a csv file into ArcMap and plot the points for each Rhino&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; csv

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\GEOG485\\Lesson4\\Project4"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;overwriteOutput &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;

targetFolder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\GEOG485\\Lesson4\\Project4"&lt;/SPAN&gt;
rhinoShape &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\GEOG485\\Lesson4\\Project4\\Rhino.shp"&lt;/SPAN&gt;
rhinoFile &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\GEOG485\\Lesson4\\Project4\\RhinoObservations.csv"&lt;/SPAN&gt;
spatialRef &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Describe&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rhinoShape&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatialReference

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;    
&lt;SPAN class="comment token"&gt;#Open CSV file and read the headers   &lt;/SPAN&gt;
trackPoints &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rhinoFile&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"r"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
textLine &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; trackPoints&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;readline&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
headerLine &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; textLine&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;     
pairList &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; headerLine&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;","&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; pairList    

polylineArray &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Array&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    

&lt;SPAN class="comment token"&gt;#Get index for header fields    &lt;/SPAN&gt;
xIndex &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pairList&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;index&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"X"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
yIndex &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pairList&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;index&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Y"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
rhinoIndex &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pairList&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;index&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Rhino"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; rhinoIndex   

&lt;SPAN class="comment token"&gt;#Created an empty dictionary    &lt;/SPAN&gt;
dictionaryRhinoTracks &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;        
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; line &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; trackPoints&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;readlines&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;    
line &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; line&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;rstrip&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
splitLine &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; line&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;","&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; splitLine    

&lt;SPAN class="comment token"&gt;#Created variable for needed field items based on index location    &lt;/SPAN&gt;
pointX &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; splitLine&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;xIndex&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;    
pointY &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; splitLine&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;yIndex&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;    
rhinoName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; splitLine&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;rhinoIndex&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;     

&lt;SPAN class="comment token"&gt;#Create a point object     &lt;/SPAN&gt;
currentPoint&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pointX    
currentPoint&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pointY    
currentPoint &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Point&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;currentPoint&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; currentPoint&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; currentPoint   

&lt;SPAN class="comment token"&gt;#Check if the dictionary does not contain name    &lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; rhinoName &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; dictionaryRhinoTracks&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;       
rhinoTrackArray &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; polylineArray&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Add&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;currentPoint&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;       
&lt;SPAN class="comment token"&gt;#Add the point object to the Array       dictionaryRhinoTracks[rhinoName].Add(currentPoint)    &lt;/SPAN&gt;

cursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;InsertCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rhinoShape&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SHAPE@'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;    
cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;polyline&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;   
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; rhinoName &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; dictionaryRhinoTracks&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;        
row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Shape &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dictionaryRhinoTracks&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;rhinoName&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;       
row&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Rhino_Name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; rhinoName       
cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;InsertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"error again"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:40:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/parsing-csv-data-and-updating-a-dictionary/m-p/681010#M52766</guid>
      <dc:creator>WilliamVan_Eck</dc:creator>
      <dc:date>2021-12-12T04:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing csv data and updating a dictionary</title>
      <link>https://community.esri.com/t5/python-questions/parsing-csv-data-and-updating-a-dictionary/m-p/681011#M52767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple house keeping items:&amp;nbsp; I suggest you get into the habit of using the syntax highlighter.&amp;nbsp; You can find it by clicking the three dots to expand the menu, click more, syntax highlighter and finally select python.&amp;nbsp; It just makes reading your code much easier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have a huge try/except block, with little to go on if you get a failure.&amp;nbsp; You might want to break up you various steps into separate try/except blocks, something like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcy&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; etc

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   first step of the process
   blah blah bla
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   second step of the process
   blah blah blah
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   etc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err

etc
etc
etc&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:40:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/parsing-csv-data-and-updating-a-dictionary/m-p/681011#M52767</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-12T04:40:22Z</dc:date>
    </item>
  </channel>
</rss>

