New answers tagged arctoolbox
Create a field with the order they are supposed to be in, then input that field into the "sort field" option.
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 = ...
Top 50 recent answers are included