I have made pythan script tool in which the
workspace + "/Data.shp" is sucessfully saving the files as here:
>>> import arcpy
... import os
... import sys
... from arcpy import env
... arcpy.env.overwriteOutput = True
###########################################
... InFc = arcpy.GetParameterAsText(0)
... workspace= arcpy.GetParameterAsText(1)
... Output_Data_shp = workspace + "/Data.shp"
... Output_Table_dbf = workspace + "/Table.dbf"
... # Process: Table Select
... arcpy.TableSelect_analysis(InFc, Output_Table_dbf, "")
... # Process: Dissolve
... arcpy.Dissolve_management(InFc, Output_Data_shp, "", "", "MULTI_PART", "DISSOLVE_LINES")
But when I allow users to define the path, the tools fails to execute. For this I used following code:
>>> import arcpy
... import os
... import sys
... from arcpy import env
... arcpy.env.overwriteOutput = True
###########################################
... InFc = arcpy.GetParameterAsText(0)
... Output_Data_shp = arcpy.GetParameterAsText(1)
... Output_Table_dbf = arcpy.GetParameterAsText(2)
... # Process: Table Select
... arcpy.TableSelect_analysis(InFc, Output_Table_dbf, "")
... # Process: Dissolve
... arcpy.Dissolve_management(InFc, Output_Data_shp, "", "", "MULTI_PART", "DISSOLVE_LINES")
For information, I am running the Python script inside a normal toolbox (i.e. not inside a python toolbox). I have defined the data types correctly under the Parameters tab of the script. Although python is quite new to me and I am not trained enough to implement codes into the script to detect errors, I think the GetParametersAsText defines the directory with Single Backslash (/) which hinders the tool to execute.
Any suggestions to solve the issue? Thanks in advance.