Error code: 000582: Error occurred during execution.
Description: An error occurred during the tool's validation or execution. No specific messages were available.
The validation process checks that a tool's set of parameter values are of the expected number, data type, and value.
Solution: Check that a tool's required parameter values are specified and are the correct data type. If the parameters are entered correctly, it may be possible the execute routine for the tool is invalid. Have the developer of the custom tool check the Execute implementation.
Stage2Tbl = r"E:\\FMP_Reports_Tool\\tempWS\\Stage2Tbl" try: mergeString = r"" for tbl in mlist: mergeString = mergeString + tempWS + tbl + ";" insertStr = mergeString.rstrip(";") gp.Merge_management(str(insertStr), Stage2Tbl, "") except: # Get the geoprocessing error messages msgs = gp.GetMessage(0) msgs += gp.GetMessages(2) # Return gp error messages for use with a script tool gp.AddError(msgs) # Print gp error messages for use in Python/PythonWin print msgs
path = 'c:/test'
path = 'c:\\test'
import os.path base_dir = 'c:/test/shp' shape_name = 'test.shp' shape_path = os.path.join(base_dir, shape_name)
import arcgisscripting, os.path gp = arcgisscripting.create(9.3) input_tables = [u'table_1', u'table_2', u'table_3'] in_dir = u'c:/path_to_my_tables' out_dir = u'c:/whatever' # let's use absolute file paths (c:/path_to_my_tables/table_1) and let's use an # ESRI value table instead of building an insert string ('c:/.../table1;c:/..../table2') # btw, why does the tool not accept a python list as input argument? val_tab = gp.CreateObject("ValueTable") for table in input_tables: val_tab.AddRow(os.path.join(in_dir, table)) merged_table = os.path.join(out_dir, 'merged_table') gp.Merge_management(val_tab, merged_table, '')
# Start a blank list for appending list = [] for tbl in mlist: # Create the full path path = tempWS+tbl print path # Append all the paths together into one big list filepath = list.append(path) ## Create the proper format for the Merge tool # Separate each item in the list by a ';' and put "" around the whole thing. mergedlist = '"'+';'.join(list)+'"' try: print "Merging to get Output.dbf..." gp.merge_management(mergedlist, "Ouptput.dbf") print gp.GetMessages() except: print "\n *** ERROR: Output.dbf failed to merge *** \n" print gp.GetMessages()
Here's how I do it.
Note: I'm printing the 'path' variable to make sure everything looks right during testing.# Start a blank list for appending list = [] for tbl in mlist: # Create the full path path = tempWS+tbl print path # Append all the paths together into one big list filepath = list.append(path) ## Create the proper format for the Merge tool # Separate each item in the list by a ';' and put "" around the whole thing. mergedlist = '"'+';'.join(list)+'"' try: print "Merging to get Output.dbf..." gp.merge_management(mergedlist, "Ouptput.dbf") print gp.GetMessages() except: print "\n *** ERROR: Output.dbf failed to merge *** \n" print gp.GetMessages()