<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error saving object from python script using GetParameterAsText in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058357#M40979</link>
    <description>&lt;P&gt;for the 2nd parameter (your workspace), do you have it defined as a "folder" ?&lt;/P&gt;&lt;P&gt;and did you try raw encoding&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Output_Data_shp =&amp;nbsp; r"{}\\Data.shp".format(workspace)&amp;nbsp; # raw encoding&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 16 May 2021 20:57:18 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-05-16T20:57:18Z</dc:date>
    <item>
      <title>Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058348#M40975</link>
      <description>&lt;P&gt;I have made pythan script tool in which the&lt;/P&gt;&lt;P&gt;workspace + "/Data.shp" is sucessfully saving the files as here:&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;BR /&gt;... import os&lt;BR /&gt;... import sys&lt;BR /&gt;... from arcpy import env&lt;BR /&gt;... arcpy.env.overwriteOutput = True&lt;BR /&gt;###########################################&lt;BR /&gt;... InFc = arcpy.GetParameterAsText(0)&lt;BR /&gt;... workspace= arcpy.GetParameterAsText(1)&lt;BR /&gt;... Output_Data_shp = workspace + "/Data.shp"&lt;BR /&gt;... Output_Table_dbf = workspace + "/Table.dbf"&lt;BR /&gt;... # Process: Table Select&lt;BR /&gt;... arcpy.TableSelect_analysis(InFc, Output_Table_dbf, "")&lt;BR /&gt;... # Process: Dissolve&lt;BR /&gt;... arcpy.Dissolve_management(InFc, Output_Data_shp, "", "", "MULTI_PART", "DISSOLVE_LINES")&lt;/P&gt;&lt;P&gt;But when I allow users to define the path, the tools fails to execute. For this I used following code:&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;BR /&gt;... import os&lt;BR /&gt;... import sys&lt;BR /&gt;... from arcpy import env&lt;BR /&gt;... arcpy.env.overwriteOutput = True&lt;BR /&gt;###########################################&lt;BR /&gt;... InFc = arcpy.GetParameterAsText(0)&lt;BR /&gt;... Output_Data_shp = arcpy.GetParameterAsText(1)&lt;BR /&gt;... Output_Table_dbf = arcpy.GetParameterAsText(2)&lt;BR /&gt;... # Process: Table Select&lt;BR /&gt;... arcpy.TableSelect_analysis(InFc, Output_Table_dbf, "")&lt;BR /&gt;... # Process: Dissolve&lt;BR /&gt;... arcpy.Dissolve_management(InFc, Output_Data_shp, "", "", "MULTI_PART", "DISSOLVE_LINES")&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Any suggestions to solve the issue? Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 04:41:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058348#M40975</guid>
      <dc:creator>badrinathkar</dc:creator>
      <dc:date>2021-05-17T04:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058357#M40979</link>
      <description>&lt;P&gt;for the 2nd parameter (your workspace), do you have it defined as a "folder" ?&lt;/P&gt;&lt;P&gt;and did you try raw encoding&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Output_Data_shp =&amp;nbsp; r"{}\\Data.shp".format(workspace)&amp;nbsp; # raw encoding&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 May 2021 20:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058357#M40979</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-16T20:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058358#M40980</link>
      <description>&lt;P&gt;I prefer to let the os module do any path wrangling for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os

Output_Data_shp = os.path.join(workspace, "Data.shp")
Output_Table_dbf = os.path.join(workspace, "Table.dbf")&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 16 May 2021 20:59:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058358#M40980</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-05-16T20:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058393#M40989</link>
      <description>&lt;P&gt;My apologies. I had done a horrible mistake in posting the 2nd code (actually I posted the same code in both places).&amp;nbsp; Please consider the following:&lt;/P&gt;&lt;P&gt;workspace=&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;workspace + "/Data.shp"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;workspace + "/Stat.dbf"&amp;nbsp; is working fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tool fails to execute when I allow users to save the files using the GetParameterAsText:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Output_Data_shp = arcpy.GetParameterAsText(1)&lt;BR /&gt;Output_Table_dbf = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have defined workspace as workspace data type.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 03:40:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058393#M40989</guid>
      <dc:creator>badrinathkar</dc:creator>
      <dc:date>2021-05-17T03:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058394#M40990</link>
      <description>&lt;P&gt;My apologies. I had done a horrible mistake in posting the 2nd code (actually I posted the same code in both places).&amp;nbsp; Please consider the following:&lt;/P&gt;&lt;P&gt;workspace=&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;workspace + "/Data.shp"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;workspace + "/Stat.dbf"&amp;nbsp; is working fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tool fails to execute when I allow users to save the files using the GetParameterAsText:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Output_Data_shp = arcpy.GetParameterAsText(1)&lt;BR /&gt;Output_Table_dbf = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 03:40:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058394#M40990</guid>
      <dc:creator>badrinathkar</dc:creator>
      <dc:date>2021-05-17T03:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058395#M40991</link>
      <description>&lt;P&gt;My apologies. I had done a horrible mistake in posting the 2nd code (actually I posted the same code in both places).&amp;nbsp; Please consider the following:&lt;/P&gt;&lt;P&gt;workspace=&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;workspace + "/Data.shp"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;workspace + "/Stat.dbf"&amp;nbsp; is working fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tool fails to execute when I allow users to save the files using the GetParameterAsText:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Output_Data_shp = arcpy.GetParameterAsText(1)&lt;BR /&gt;Output_Table_dbf = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have defined workspace as workspace data type.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 03:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058395#M40991</guid>
      <dc:creator>badrinathkar</dc:creator>
      <dc:date>2021-05-17T03:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058396#M40992</link>
      <description>&lt;P&gt;workspace .... should be defined as a "folder" in your toolbox.&amp;nbsp; Double backslashes as in my examples would be preferable (or use the os module as David suggested), you don't want to mix back and fore slashes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 03:49:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058396#M40992</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-17T03:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error saving object from python script using GetParameterAsText</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058397#M40993</link>
      <description>&lt;P&gt;It would help if you posted the&amp;nbsp;&lt;EM&gt;actual&lt;/EM&gt; error message. But a wild stab in the dark is that you have an undeclared variable.. You declare the dbf as&amp;nbsp;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;Output_Table_dbf&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; and then attempt to use&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier" size="2"&gt;&lt;STRONG&gt;Output_Stat_Table_dbf&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 04:07:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-saving-object-from-python-script-using/m-p/1058397#M40993</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-05-17T04:07:44Z</dc:date>
    </item>
  </channel>
</rss>

