Hello,
I am having problems getting the "BatchBuffer.py" script from the esri script site. I have altered it a little to fit the system here (working with 9.2). And I am new to the world of python so maybe I am missing something obvious. I have followed other posts advice in putting all my input files into geodatabase and not running the script from the Toolbox.
The error message that keeps popping up that I haven't managed to solve is:
Traceback (most recent call last):
File "W:\NJurko\MontrealLake\testing_ground\BatchBuffer.py", line 46, in ?
gp.Buffer_analysis(fc, outFeatureClass, bufferSize_param, lineSide, lineEndType, dissolveOption)
RuntimeError:
Error occurred during execution
This is the script I am using:
#Import standard library modules
import sys
import os
import arcgisscripting
#Create the geoprocessor object.
gp = arcgisscripting.create()
#Create a system argument variable the input feature class.
ws = "W:\\NJurko\\MontrealLake\\testing_ground\\mtltest.gdb"
gp.workspace = ws
#Create a sysargv for the output workspace.
outWorkspace = "W:\\NJurko\\MontrealLake\\testing_ground\\ouputs\\"
gp.toolbox = "analysis"
#Create a sysargv for the type of features to be buffered.
#Create sysargv for the buffer tool parameters.
bufferSize = "10"
lineSide = "FULL"
lineEndType = "ROUND"
dissolveOption = "ALL"
dissolveField = "#"
#get a list of the feature classes of type LINE in the input folder.
fcs = gp.ListFeatureClasses()
#Loop through the list of feature classes.
fcs.reset()
fc = fcs.Next()
while fc:
#Generate output path and filename. The last four characters (".shp") are removed from 'fc' so the new filepath can be generated correctly.
#New file names are [buffered filename]_buff.shp; e.g., "roads_buff.shp"
outFeatureClass = outWorkspace + "\" + fc[:-4]" + "_buff.shp"
#Format the inputed buffer distance so it can be used in the buffer tool.
bufferSize_param = bufferSize + ".000000 meters"
#Buffer each feature class in the list.
gp.Buffer_analysis(fc, outFeatureClass, bufferSize_param, lineSide, lineEndType, dissolveOption)
#Get the next feature class in the list.
fc = fcs.Next()
print gp.GetMessages (1)
Thanks for the help!
NJurko