Hot answers tagged scripting
Should be: stringvariable = "banana" arcpy.CalculateField_management("c:\point.shp", "SUBDIRECT", "'" + stringvariable + "'", "PYTHON") If you double quote stringvariable, Python won't interpret it as "banana". Also, You have to quote the string for the field calculator to work.
If you are creating a script tool in a regular toolbox, when defining the tools parameters, for the parameter you want to pass as a list, set the "MultiValue" property to Yes. The multiple values will get passed to your script as a semi-colon separated string. To use as a list in your python script, split the string on the semi-colon, i.e: ...
You can use the sys module or arcpy module to input these arguments: i.e. import sys,arcpy # Version 1 - this will give you a python list of the arguments you enter input_arguments = sys.argv # i.e. input_arguments will = ['abc,123','def,456'] # Version 2 first_argument = arcpy.GetParameter(0) second_argument = arcpy.GetParameter(1) etc.
This bit of code might help you programmatically carry out steps 3 and 4. It will load a composer template from file and export a map to jpeg by creating a atlas. It will require some tweaking but should get you started. def quick_export(self, ref, stype, scale): # Add all layers in map canvas to render myMapRenderer = ...
I'm posting another answer because I've learned a new method for checking the status of the Editor in ArcMap using ArcObjects and Python together. My answer borrows heavily from the work done by Mark Cederholm as referenced in this post: How do I access ArcObjects from Python?, and code examples provided by Matt Wilkie in his "Snippits.py" file. You will ...
Only top voted, non community-wiki answers of a minimum length are eligible