Tag Info

New answers tagged


You can use the locale module to let the parsing of float depends of the environment locale. >>> import locale >>> locale.setlocale(locale.LC_ALL, '') # (optional here) use user's preferred locale >>> locale.getlocale() ('en_GB', 'ISO8859-1') # my current env locale >>> locale.atof('12,3') 123.0 # wrongly parsed # with ...


Your issue is arising due to the use of a comma as the decimal mark. It may help to understand that in your script you are not converting a double into a float, you are converting a string into a float. The string, when a comma is used as the decimal mark, is invalid. I would make use of the Replace method here to ensure that a decimal point is used in the ...


Okay guys I figured out how to deal with it. It's not a perfect solution but it works. Set parameter datatype = 'GPString' instead of 'GPFeatureLayer' and then when you want to blank it out by setting value = '', you then have to reset my_param.filter.list = [(option1), (option2), ...]. So, write a method that returns all the options that you want in a list ...


Change the "Obtained from" property for the input to the shapefile parameter.


Within the execute method, each parameter's value can be accessed from the list using the valueAsText method. Other Parameter object properties can be accessed as needed. Here is your solution: def execute(self, parameters, messages): #parameters[0] is your value table vt_text = parameters[0].valueAsText arcpy.AddMessage(vt_text) ...


@KHibma is right. Use DEWorkspace def getParameterInfo(self): param0 = arcpy.Parameter( displayName="Input Sde Connection", name="in_conn_file", datatype="DEWorkspace", parameterType="Required", direction="Input") To limit the choices: param0.filter.type = "Workspace" param0.filter.list = ["Remote Database"]


In addition to checking the altered flag I'd also evaluate the value of the parameter. You could use valueAsText or value, but valueAsText is slightly faster (especially if working with a layer). def updateParameters(self, parameters): my_param = parameters[0] if my_param.altered and my_param.valueAsText: #(function that appends ...


If you want to have one script tool, then the passing of input and output parameters happens in the script, using python, and would not be controlled in the tool properties. This is one of many examples in the ArcGIS help pages on how this works. In the properties you only setup the initial inputs that the user will choose. The rest you do in code.

Top 50 recent answers are included