<?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: cannot open file using arcpy.da.InsertCursor (randomly) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557752#M43600</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wonder if it's a memory issue; just a WAG (wild a$$ guess)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Sep 2020 22:13:10 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2020-09-17T22:13:10Z</dc:date>
    <item>
      <title>cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557744#M43592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, I'm hoping someone can help me a problem I can't figure out.&amp;nbsp; Below is my code.&amp;nbsp; I keep getting a RuntimeError: cannot open 'file I'm writing to' using a arcpy.da.InsertCursor.&amp;nbsp; It keeps locking for some reason, I do not have arc open when running (running it from PyCharm), and it will write to the file thousands of times... I am writing line segments to a feature class and it will do it thousands of times, but then seemingly randomly say it can't access it.&amp;nbsp; I have run it many times and it get's locked up in different places each time.&amp;nbsp; The only info I can find is that people need to close their cursors, but all my cursors (both search and insert cursors) are closed after each use.&amp;nbsp; I'm not sure what else to do.&amp;nbsp; Any ideas?&amp;nbsp; Description of what code is trying to do below if that is helpful at all as well as a screen shot of the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy

# Set environments / workspace.  Workspace should point to a gdb that has all the effort point feature classes
arcpy.env.workspace = r"C:\Users\bhodge\Dropbox (New England Aquarium)\MonumentsWork\MonumentSpeciesDiversity\DataFromBob\DerivedData.gdb"
arcpy.env.overwriteOutput = True
# This is the input points
fc = r"C:\Users\bhodge\Dropbox (New England Aquarium)\MonumentsWork\MonumentSpeciesDiversity\DataFromBob\DerivedData.gdb\EffortPoints_Prj_TEST_B"
# This is the output lines
sr = arcpy.Describe(fc).spatialReference
outputFC = arcpy.management.CreateFeatureclass(r"C:\Users\bhodge\Dropbox (New England Aquarium)\MonumentsWork\MonumentSpeciesDiversity\DataFromBob\DerivedData.gdb", "EffortLines_TEST", "POLYLINE", "", "DISABLED", "DISABLED", sr)
# Add desired fields to outputFC
arcpy.AddField_management(outputFC, "MONTH", "TEXT")
arcpy.AddField_management(outputFC, "YEAR", "SHORT")
arcpy.AddField_management(outputFC, "FILEID", "TEXT")
arcpy.AddField_management(outputFC, "EVENTNO", "LONG")

# Make a feature Layer of the input points to work off.  This layer is temporary and will not persist after session ends unless saved
arcpy.MakeFeatureLayer_management(fc, "fc_lyr")

# Sort the table by fileid and eventno and create a new fc called fc_sort
sort_fields = [["FILEID", "ASCENDING"], ["EVENTNO", "ASCENDING"]]
fc_Sorted = arcpy.Sort_management("fc_lyr", "fc_sort", sort_fields)

# Create the search cursor
fields = ['FILEID', 'beauf_num', 'LEGTYPE', 'LEGSTAGE', 'vis_num', 'olviz_num', 'alt_num', 'LAND', 'MONTH', 'YEAR', "EVENTNO", "SHAPE@"]
with arcpy.da.SearchCursor(fc_Sorted, fields) as cur1:
    for row in cur1:
        # Name variables and assign values starting on first record of table
        fileid1 = row[0]
        beaufort = row[1]
        legtype = row[2]
        legstage = row[3]
        visiblty = row[4]
        oldvis = row[5]
        alt = row[6]
        land = row[7]
        month = row[8]
        year = row[9]
        eventno = row[10]
        # Get the geometry of the point for that record
        geom1 = row[11].getPart()
        # Go to the next row, get the fileid and geometry
        next_row = cur1.next()
        fileid2 = next_row[0]
        land2 = next_row[7]
        geom2 = next_row[11].getPart()
        # Create an Array
        array = arcpy.Array()
        # Test the parameters to see if it should be on-effort
        if ((fileid1 == fileid2) and (beaufort != None and beaufort &amp;lt;= 4) and ((visiblty != None and visiblty &amp;gt;= 2) or (oldvis == 1)) and \
                (land != 1 and land2 != 1) and (alt != None and alt &amp;lt;= 366) and \
                (not legtype == '0') and \
                (not (legtype == '7' and legstage == ' ')) and \
                (not (legtype == '9' and legstage == ' ')) and \
                (not (legtype == '5' and legstage == ' '))):
            array.add(geom1)
            array.add(geom2)
            polyline = arcpy.Polyline(array, sr)
            with arcpy.da.InsertCursor(outputFC, ['SHAPE@', "MONTH", "YEAR", "FILEID", "EVENTNO"]) as insertCursor1:
                insertCursor1.insertRow([polyline, month, year, fileid1, eventno])
            del insertCursor1
            array.removeAll()
        else:
            pass
del cur1
print("first with loop completed")
with arcpy.da.SearchCursor(fc_Sorted, fields) as cur2:
    cur2.next()
    for row in cur2:
        # Name variables and assign values starting on first record of table
        fileid1 = row[0]
        beaufort = row[1]
        legtype = row[2]
        legstage = row[3]
        visiblty = row[4]
        oldvis = row[5]
        alt = row[6]
        land = row[7]
        month = row[8]
        year = row[9]
        eventno = row[10]
        # Get the geometry of the point for that record
        geom1 = row[11].getPart()
        # Go to the next row, get the fileid and geometry
        next_row = cur2.next()
        fileid2 = next_row[0]
        land2 = next_row[7]
        geom2 = next_row[11].getPart()
        # Create an Array
        array = arcpy.Array()
        # Test the parameters to see if it should be on-effort
        if ((fileid1 == fileid2) and (beaufort != None and beaufort &amp;lt;= 4) and ((visiblty != None and visiblty &amp;gt;= 2) or (oldvis == 1)) and \
                (land != 1 and land2 != 1) and (alt != None and alt &amp;lt;= 366) and \
                (not legtype == '0') and \
                (not (legtype == '7' and legstage == ' ')) and \
                (not (legtype == '9' and legstage == ' ')) and \
                (not (legtype == '5' and legstage == ' '))):
            array.add(geom1)
            array.add(geom2)
            polyline = arcpy.Polyline(array, sr)
            with arcpy.da.InsertCursor(outputFC, ['SHAPE@', "MONTH", "YEAR", "FILEID", "EVENTNO"]) as insertCursor2:
                insertCursor2.insertRow([polyline, month, year, fileid1, eventno])
            del insertCursor2
            array.removeAll()
        else:
            pass
del cur2
print("Done")&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;‍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t;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is the Error I get, but this changes depending on the run.&amp;nbsp; Sometimes it's in in insertCursor1 sometimes in insertCursor2 depending on how far it get's that run.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" "C:/Users/bhodge/Dropbox (New England Aquarium)/MonumentsWork/MonumentSpeciesDiversity/MonumentsPython/Trackline_Fields.py"
Traceback (most recent call last):
  File "C:/Users/bhodge/Dropbox (New England Aquarium)/MonumentsWork/MonumentSpeciesDiversity/MonumentsPython/Trackline_Fields.py", line 59, in &amp;lt;module&amp;gt;
    with arcpy.da.InsertCursor(outputFC, ['SHAPE@', "MONTH", "YEAR", "FILEID", "EVENTNO"]) as insertCursor1:
RuntimeError: cannot open 'C:\Users\bhodge\Dropbox (New England Aquarium)\MonumentsWork\MonumentSpeciesDiversity\DataFromBob\DerivedData.gdb\EffortLines_TEST'

Process finished with exit code 1&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code description: Basically I'm running through a point table, looking at variables in the first row, and some in the next row and if those parameters meet my requirements, I draw a line to connect the points and save that to a featureclass I created along with some variables I need attached to those line segments.&amp;nbsp; I run through two searchCursors because of how I need to access the first and second line, it skips one iteration, (basically the first one compares points 1&amp;amp;2, 3&amp;amp;4, etc.) so I run it through a second searchCursor accessing the opposites (comparing 2&amp;amp;3, 4&amp;amp;5, etc.).&amp;nbsp; It's somehow locking the file I'm trying to write to in the insertCursor, but it does so randomly and I don't know why or how to fix it. Thanks in advance for any suggestions!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:05:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557744#M43592</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2021-12-12T00:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557745#M43593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you just store the results of the Search Cursor in a dictionary then throw them in at the end with an Insert Cursor instead?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 20:16:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557745#M43593</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-09-17T20:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557746#M43594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let me see if I have this right: you (re)create a feature class (outputFC) and add fields to it.&amp;nbsp; Then you open an insert cursor on that same outputFC, and that's when it fails?&amp;nbsp; Like it's getting hung up because of the add field steps?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 20:57:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557746#M43594</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-09-17T20:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557747#M43595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for&amp;nbsp; your response.&amp;nbsp; I was thinking if that could work.&amp;nbsp; I've never used a dictionary before but was trying to figure out it it could hold both the geometry of the line as well as all the attributes for the fields I want to populate per record in a way I could then write to a featurclass all at once at the end.&amp;nbsp; That I haven't figured out yet.&amp;nbsp; Do you know if that is possible with a dictionary?&amp;nbsp; Basically I need to create the line from two points, save that line geometry, and grab variable values from the points from a number of fields and store those with the line, then be able to write all of that to a new feature class.&amp;nbsp; Previously when I was working with this data, I was just creating lines and did not need to keep attribute information from the original point data so I just stored all the lines in a list and wrote them all to a featureclass at the end.&amp;nbsp; That worked, but I now need to keep attribute&amp;nbsp;values and associate them back with the lines so that's where I'm struggling the best method to accomplish that.&amp;nbsp; I was reading up on dictionaries today, but couldn't figure out how to accomplish this with them, however, maybe I just haven't found the right information/example?&amp;nbsp; If you know of any examples or resources for this I would be grateful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 21:29:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557747#M43595</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-17T21:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557748#M43596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See :&amp;nbsp;&amp;nbsp;&lt;A href="https://community.esri.com/blogs/richard_fairhurst/2014/11/08/turbo-charging-data-manipulation-with-python-cursors-and-dictionaries"&gt;/blogs/richard_fairhurst/2014/11/08/turbo-charging-data-manipulation-with-python-cursors-and-dictionaries&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 21:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557748#M43596</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-09-17T21:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557749#M43597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not quite.&amp;nbsp; You have the beginning right.&amp;nbsp; I create a feature class and add fields to it.&amp;nbsp; I then create lines from points as well as grab variable values to populate the fields.&amp;nbsp; I use an insert cursor on the created feature class to add the created line and populate the fields. Then it goes to the next record and continues.&amp;nbsp; It successfully does this a number of times (it will write 100s to 1000s of lines and populate fields to this feature class).&amp;nbsp; Then seemingly randomly, it will then say it cannot access the feature class (even thought it had just accessed it 100s to 1000s of times).&amp;nbsp; Each time I run, it stops at a different point.&amp;nbsp; For instance, one time it will write 478 lines to the feature class, then throw the error.&amp;nbsp; Next time I run it it will do 6,893 lines, the next time 2,645 lines.&amp;nbsp; It seem like it's getting locked up somehow, but I don't know why.&amp;nbsp; I am sure to release all my cursors after you and have it open no where else when running.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 21:36:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557749#M43597</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-17T21:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557750#M43598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for this link.&amp;nbsp; I'm not sure it's helpful in my case since I'm not using the field calculator to populate my fields and am doing it with an insert cursor (and aren't doing any joins for summary statistics)... perhaps I can look into using an update cursor instead for the fields, but at the same time, I can accomplish populating the fields within the insert cursor which I need to use anyways to add the lines, and I don't believe that is where the issue lies.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 21:44:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557750#M43598</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-17T21:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557751#M43599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've not read through the code well enough but I will have a read through properly tomorrow.&amp;nbsp; You may want to access the geometry token (@SHAPE) in the search cursor and use that as an input to the geometry field of the insert cursor.&amp;nbsp; I'm also not sure what getpart does without googling when I have time as i'm far from expert.&lt;BR /&gt;&lt;BR /&gt;Even without a dictionary you could have a list of lists which you iterate over&lt;/P&gt;&lt;P&gt;listy_mc_list_face = [ &amp;nbsp;&amp;nbsp; [field1, field2 … ,geometry object (@shape)], [field1, field2 ….], [… &amp;nbsp;&amp;nbsp; ] &amp;nbsp; ]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 21:58:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557751#M43599</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-09-17T21:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557752#M43600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wonder if it's a memory issue; just a WAG (wild a$$ guess)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2020 22:13:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557752#M43600</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-09-17T22:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557753#M43601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I watched my memory while it was running, and never got above like 32%.&amp;nbsp; My CPU hit 100 a couple times, but it didn't throw the error then and continued.&amp;nbsp; I ran it again this morning and it magically worked (I changed nothing) once, but then I tried it with more data (I was testing with about 5,000 points), but then just tried it with about 400,000 points (I actually have 4.7&amp;nbsp; million I need to run, but I think I'll need to break it up), and it failed again with the same error that it could not open the file... sigh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2020 14:35:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557753#M43601</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-18T14:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557754#M43602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c; "&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c; "&gt;Yep, I do use the @SHAPE token and do use that in the insert cursor (lines 25, then 59).&amp;nbsp; Here is was ESRI says the getpart does:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c; "&gt;&lt;SPAN&gt;The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="font-size: 17px;"&gt;getPart&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;method returns an array of point objects for a particular part of the geometry if an index is specified. If an index is not specified, an array containing an array of point objects for each geometry part is returned.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c; "&gt;I need to add the points to an array in which I create a line, so the getpart returns and array of the point I grab from the @SHAPE token.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #4c4c4c; "&gt;As for your list of lists suggestion, I'm wondering.... If I iterate over a list, wouldn't that be doing what I"m doing now, just with a list instead of within each if statement?&amp;nbsp; I guess what I"m wondering is if when I iterate over the list, wouldn't it just be using the insertcursor over and over again as it iterates through, similar to what it's doing now?&amp;nbsp; Just wondering if I will have the same problem as I'm having now and it will randomly say it can't access the file when it's somewhere within the list iteration.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2020 14:46:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557754#M43602</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-18T14:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557755#M43603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When in doubt I always defer to these guys...&amp;nbsp; Seriously though, I'm at a total loss...&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/507265_itCrowd.gif" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2020 14:46:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557755#M43603</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-09-18T14:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557756#M43604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Joe!&amp;nbsp; I appreciate your time and effort:.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2020 14:49:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557756#M43604</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-18T14:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557757#M43605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Out of curiosity, it looks like you're writing to a dropbox location based on the input/output. Have you tried writing to&amp;nbsp;a folder that isn't a dropbox path?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ignoring the&amp;nbsp;suggestions above for now, does that work with your original code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There might be some funny sync things happening between dropbox and the folder if you're writing a file continuously to it from python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Volume wise, if you're using a da.search cursor it shouldn't matter if it's 10 rows or 4.7 million in terms of memory usage.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557757#M43605</guid>
      <dc:creator>CodyScott</dc:creator>
      <dc:date>2020-09-28T15:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: cannot open file using arcpy.da.InsertCursor (randomly)</title>
      <link>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557758#M43606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cody, you are a genius!&amp;nbsp; I should have thought of that sooner, but with 5+ years of working directly to dropbox with arc and never having a problem, I overlooked that.&amp;nbsp; You're were right!&amp;nbsp; The issue seems to be writing to the same file in dropbox over and over again, I wrote the file directly in my C drive and it worked.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&lt;IMG alt="template | You Did It. The Crazy Son of a Bitch, You Did It | Know Your Meme" src="https://i.kym-cdn.com/photos/images/facebook/001/569/898/26c.jpg" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:12:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/cannot-open-file-using-arcpy-da-insertcursor/m-p/557758#M43606</guid>
      <dc:creator>BrookeHodge</dc:creator>
      <dc:date>2020-09-29T18:12:38Z</dc:date>
    </item>
  </channel>
</rss>

