This convenient arcpy function that was there in 10.3 has vanished at 10.4, breaking all my python scripts that use it.
Thanks Esri.
Solved! Go to Solution.
I don't think AddMsgAndPrint was ever an arcpy function. It's definitely not listed in the 10.3 or 10.2 help pages and calling arcpy.AddMsgAndPrint raises an "AttributeError: 'module' object has no attribute 'AddMsgAndPrint'"
Are you sure you didn't have a custom module that defined AddMsgAndPrint? Something like:
From: Tabulate Intersection—Help | ArcGIS for Desktop
def AddMsgAndPrint(msg, severity=0): # Adds a Message (in case this is run as a tool) # and also prints the message to the screen (standard output) # print(msg) # Split the message on \n first, so that if it's multiple lines, # a GPMessage will be added for each line try: for string in msg.split('\n'): # Add appropriate geoprocessing message # if severity == 0: arcpy.AddMessage(string) elif severity == 1: arcpy.AddWarning(string) elif severity == 2: arcpy.AddError(string) except: pass
I don't think AddMsgAndPrint was ever an arcpy function. It's definitely not listed in the 10.3 or 10.2 help pages and calling arcpy.AddMsgAndPrint raises an "AttributeError: 'module' object has no attribute 'AddMsgAndPrint'"
Are you sure you didn't have a custom module that defined AddMsgAndPrint? Something like:
From: Tabulate Intersection—Help | ArcGIS for Desktop
def AddMsgAndPrint(msg, severity=0): # Adds a Message (in case this is run as a tool) # and also prints the message to the screen (standard output) # print(msg) # Split the message on \n first, so that if it's multiple lines, # a GPMessage will be added for each line try: for string in msg.split('\n'): # Add appropriate geoprocessing message # if severity == 0: arcpy.AddMessage(string) elif severity == 1: arcpy.AddWarning(string) elif severity == 2: arcpy.AddError(string) except: pass
Well it looks just like that function but appeared as a function of arcpy, not a separate function. It popped up in the autocompletion so I have been using it extensively in 10.3. To my surprise it has disappeared after an update. Maybe ET Tools added it? Maybe some other tool I have installed long ago and forgotten and did not realise that it extended arcpy. Is there one? What did arcapi do?
No idea, sorry. I just know that it's not in arcpy 10.2 or 10.3 on our systems.
Is there really a need for it (other than to stop breaking existing code)? arcpy.AddMessage(msg), arcpy.AddError(msg) et. al all print to stdout (stderr?) anyway.