AnsweredAssumed Answered

Python cannot "see" output from geometric trace.

Question asked by rsm_ddms on Apr 19, 2017
Latest reply on Apr 19, 2017 by rsm_ddms

I have a python based tool that is error-ing out at the point where it needs to access the output of a geometric trace:

 

# Process: Trace Geometric Network
arcpy.AddMessage("> Downstream Trace...")
down_tg = "DOWNSTREAM_TRACE_GROUP"
arcpy.TraceGeometricNetwork_management(Geometric_Network, down_tg, poe_copy, \
"TRACE_DOWNSTREAM", "", "", "", "", "", "NO_TRACE_ENDS", "NO_TRACE_INDETERMINATE_FLOW", \
"", "", "AS_IS", "", "", "", "AS_IS")

#Process: Try to prevent CPs from snapping to junctions.
currmxd.save()
down_trace = down_tg+r"\NHN_HN_PrimaryDirectedNLFow_1"

arcpy.AddMessage("> Modifying downstream trace to minimize junction-snapping...")
out_verts = "in_memory\\out_verts"

 arcpy.FeatureVerticesToPoints_management(down_trace, out_verts,"BOTH_ENDS")

Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset DOWNSTREAM_TRACE_GROUP\NHN_HN_PrimaryDirectedNLFow_1 does not exist or is not supported
Failed to execute (FeatureVerticesToPoints).

 

DOWNSTREAM_TRACE_GROUP\NHN_HN_PrimaryDirectedNLFow_1 DOES EXIST!  It has been created!

After I get this error, I can run a tool from the toolbox - for example "Copy Features" and I can see "GeometricNetwork\NHN_HN_PrimaryDirectedNLFow_1" in the drop down, I can select it, and I can create an output.

But Python simply cannot see it.

In the python window within the mxd, if I list layers, I cannot see this group layer ("GeometricNetwork"), but if I select the python snippet from the copy features tool above and simply paste it in, it runs fine with the reference to "GeometricNetwork\NHN_HN_PrimaryDirectedNLFow_1" right there in the code line.

I ran the geometric trace as a tool and the output ends up in my TOC just fine.

I ran it as a model and selected "Add to Display" on the green egg output symbol.

Perfectly fine.

Python simply refuses to see this output. It is not getting added to the mxd. I tried to create a layer, but I can't do that because no tool will recognize the initial output from the trace tool.

Any idea how to get python to acknowledge the existence of this output?

 

The attached picture shows the visible "DOWNSTREAM_TRACE_GROUP" and the output layer that Python just claimed didn't exist.

 

Thank you very much.

 

Randy McGregor

Attachments

Outcomes