You can throw an exception when no solution is found:try: arcpy.Solve_na(layer1) except (RuntimeError): print "No solution is found for " + str(layer1)
I'm hoping someone could modify the code so this could be used as a stand-alone script. Currently it relies on a route layer being in an ArcMap session. I'd appreciate any advice. Thanks in advance.