Select to view content in your preferred language

Module object reading error attribute

1622
10
01-10-2023 10:22 AM
JasonMa
Emerging Contributor

 

 

"""
Tesing the detect Gaps
"""
#import arcpy module
import arcpy

#Chcek out any necessary to licnes
arcpy.CheckOutExtension("Calgary1_done")

#local variables set
setNetwork = r"G:\Jason Ma\2022Q3 HERE shapefiles\Corridors\Old corridors\Calgary1_done"
#event =
final_gaps_output= r"G:\Jason Ma\2022Q3 HERE shapefiles\Corridors\Old corridors\New_Gaps_Cal1"



#Detect the GAPS in the linear events
arcpy.env.overwriteOutput = 1 
arcpy.DetectGapsForLinearEvents_locref(setNetwork, final_gaps_output)

 

 

Hello all staff of Esri, 

 

I am trying to create a function which detect gaps within road layer, seems that the library from Arcpy is not reading the module correctly in of the arcpy functions:  

Error: 

Runtime error
Traceback (most recent call last):
File "<string>", line 18, in <module>
AttributeError: 'module' object has no attribute 'DetectGapsForLinearEvents_locref'
>>>

 

Any suggests and Help I glad to hear , Thanks you 

0 Kudos
10 Replies
by Anonymous User
Not applicable

The CheckoutExtension() is for authorizing extension licenses. Check out the documentation here

"Calgary_done" is not an extension listed in the docs.

Note that items in {} are optional parameters and {} should not be included in your code if you have variables to pass in to the function.

arcpy.DetectGapsForLinearEvents_roads(in_network,in_event,out_feature,{in_tvd},{in_from_measure},{in_to_measure},{in_tolerance},setNetwork, final_gaps_output)

 

You need to assign your variables to the corresponding arguments position in the ().

#local variables set
setNetwork = r"G:\Jason Ma\2022Q3 HERE shapefiles\Corridors\Old corridors\Calgary1_done"
#event =
final_gaps_output= r"G:\Jason Ma\2022Q3 HERE shapefiles\Corridors\Old corridors\New_Gaps_Cal1"

arcpy.DetectGapsForLinearEvents_roads(setNetwork, in_event, final_gaps_output)

 You are missing the required in_event parameter-

0 Kudos