1

I am trying to use the Dissolve_management tool using ArcPy. I keep getting an error that reads "Parameters are not valid.", and I cannot figure out where I am going wrong. Here is the code:

env.workspace = "H:/Data/"
input = "Analysis/mtbs_state_2000/al.shp"
output = "Analysis/2000_dissolved/al.shp"
statistics_fields = [["km2", "SUM"], ["HU90", "SUM"]]
arcpy.Dissolve_management(input, output, "Fire_ID", statistics_fields)

enter image description here

6
  • Try ["Fire_ID"] (with brackets) ?
    – Erica
    Commented Dec 5, 2015 at 22:36
  • Unfortunately, no luck :/
    – Anthony To
    Commented Dec 5, 2015 at 22:47
  • 2
    env.workspace shouldn't have a trailing slash.
    – Paul
    Commented Dec 5, 2015 at 22:56
  • Nice catch Paul. However, I'm still seeing the issue
    – Anthony To
    Commented Dec 6, 2015 at 0:21
  • Are those the actual field names or are they aliases?
    – Paul
    Commented Dec 6, 2015 at 5:10

1 Answer 1

1

I think your Analysis folder is not being accessed, try:

# also notice the double slashes throughout
env.workspace = "H:\\Data" 
input = env.workspace +"\\Analysis\\mtbs_state_2000\\al.shp"
output = env.workspace +"\\Analysis\\2000_dissolved\\al.shp"
statistics_fields = [["km2", "SUM"], ["HU90", "SUM"]]
arcpy.Dissolve_management(input, output, "Fire_ID", statistics_fields)
6
  • This is assuming the 'Analysis' folder is in 'H:/Data'
    – yanes
    Commented Dec 5, 2015 at 23:24
  • 1
    os.path.join() is your friend. Though, it kind of defeats the purpose of setting env.workspace if you are just going to concatenate it anyways....
    – Paul
    Commented Dec 5, 2015 at 23:30
  • 1
    Are you sure that double forward slashes ("//") will not itself cause a problem? I know double backslashes is fine ("\\"), as well as single forward slash ("/") and lastly single backslashes ("\") but only with an r before the string.
    – PolyGeo
    Commented Dec 6, 2015 at 0:10
  • 1
    Thanks for the answer Yang. The ArcPy documentation uses the single forward slash notation, and I've used that with all my other scripts without any issues. But I tried your notation, still not working
    – Anthony To
    Commented Dec 6, 2015 at 0:20
  • Sorry.. @PolyGeo is right it is either double back slash("\\") or a single forward slash ("/") with an r in front of the path. For example: `env.workspace = r"H:/Data". I've edited the answer to reflect this.
    – yanes
    Commented Dec 6, 2015 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.