I have run into a script error today with some code that was not altered since and worked yesterday..
I have tracked it down to this example (some paths shortened):
spatialRef = arcpy.Describe('Y:/......../xyz.gdb/BeispielLeitungenZ').spatialReference
array = arcpy.Array()
array.append(arcpy.Point(100000, 40000, 500))
array.append(arcpy.Point(100000, 42000, 510))
createCursor = arcpy.da.InsertCursor('...../xyz.gdb/Leitungen', ['SHAPE@', 'quellLeitung', 'quellStartMastenID', 'quellEndMastenID'])
cable = arcpy.Polyline(array, spatialRef, True, False)
createCursor.insertRow([cable, 1, 1, 1])
The error I get is:
Traceback (most recent call last): File ".....\pyScripts\createCables.py", line 37, in <module> createCursor.insertRow([cable, 1, 1, 1])SystemError: error return without exception set
Failed to execute (createCables).
Does somebody have an idea why this could be?
The script runs fine with the last line commented out.
The attr table of the target FC shows the fields (correctly):
OBJECTID, Shape, Shape_Length, quellLeitung, quellStartMastenID, quellEndMastenID
This is hard to track down, as I have no clue what the exception actually is ..
Something with the software must have changed. [Or license? I'm actually switching accounts.]
Any input welcome! Thanks!
If the code worked yesterday and stopped working today, I wonder whether the feature class or file geodatabase got corrupted. What if you try the code using a freshly created file geodatabase with a freshly created feature class?
Did you create the code the other day and it worked that day, or has the code been around working for a while and just stopped working? The sudden breakage doesn't make sense. Did anything else change between one day and the next? Different machine? Different version of ArcGIS? New software installed on the machine? Did someone change the spatial reference of BeispielLeitungenZ so now it doesn't match the feature class you are trying to insert into?
It indeed was a change in the 'BeispielLeitungenZ' FC that was given back to me from an other person with added Z information of the point features, but the spatialReference of that new FC was different than the first one, which caused the error.
I had tracked all code down and the intermediate results were all still correct (point positions, ..), with the new data, which did not give me the clue of the wrong spatialRef.
Turns out it was a combination of tests with a different projection/spatial reference.
I had worked on a copy I got with the same data, just in a different projection. It seems adding lines to a position outside the extent (far off) was the issue and this caused a non-defined error, which is not helpful ..
Issue solved. *phew*