New answers tagged arctoolbox
Try setting arcpy.env.workspace to your working directory. e.g., import arcpy arcpy.env.workspace = 'c:/temp/testarcgis/frafil'
In AddField, provide the full path to JHJ or change your workspace (arcpy.env.workspace) to r"C:\temp\TestArcGis\FraFil" before AddField.
It works in the python window because JHJ is likely a layer in the map and therefore can be reference in your script as "JHJ". When run outside of Arcmap, you need to tell arcpy where to look. Here are just a few ways you can do this (untested, but it should give you a few ideas): 1) jhj = ...
Deleting the fields directly is an excellent and simple approach. However, you may want to be more conservative and create a copy of the original feature classes with only the fields you need. One approach is to create a model in ModelBuilder to do this for you. In the attached model, you can see an iterator is used to loop through all of the feature ...
if you stay with the tools, you can first select all the fields then unselect the ones that you wnt to keep. You could also create a Python script to do this, but if you don't have a fixed rule and you need to enter the field names manually, this will not help. import arcpy fields = arcpy.Listfields(fc) #if you can use a key to identify the fields to ...
Top 50 recent answers are included