<?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: Python GP Package in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362516#M28601</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Shaun,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any chance you could send me your original tool in a zip file and data necessary to run it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The packaging of script tools does do variable substitution as you have discovered, however it should always run once it becomes a GPK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're seeing an instance where that isn't the case I want to understand why.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're able to share, please send to khibma[@]esri.com&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2012 16:31:28 GMT</pubDate>
    <dc:creator>KevinHibma</dc:creator>
    <dc:date>2012-06-25T16:31:28Z</dc:date>
    <item>
      <title>Python GP Package</title>
      <link>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362514#M28599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm running into an issue when packaging up a python script. In the script it adds a field and then calculates the field like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Calculate Fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management(SelectedStrategy_Loss, "Before_nLoss", "[urineNLeached]", "VB", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This all works fine when I run it in ArcGIS Desktop as a tool, however after I package up this process, I notice the following is done at the top of my script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Esri start of added variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os, arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_1 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Strategies\\Strategies_Polygon')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_2 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Strategies\\Strategies_Line')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_3 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Strategies\\Strategies_Point')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_4 = os.path.join(arcpy.env.packageWorkspace,u'data.gdb\\Nitrogen')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_5 = u'%scratchGDB%\\SelectedStrategy'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_6 = u'%scratchGDB%\\SelectedStrategyLoss'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_7 = u'Before_nLoss'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_8 = u'"urineNLeached"'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_9 = u'After_nLoss'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_10 = u'"Before_nLoss" * 0.91'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Esri end of added variables&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, the packaging process seems to be converting the square brackets to quotation marks - u'"urineNLeached"'. When I change this to u'[urineNLeached]', it workd fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just wondering if this is a bug and if it what the workaround would be?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2012 05:42:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362514#M28599</guid>
      <dc:creator>ShaunWeston</dc:creator>
      <dc:date>2012-06-25T05:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Python GP Package</title>
      <link>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362515#M28600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alright! Managed to fix it be changing the FieldCalculator to use python instead of VB (makes sense!) and the gp packager kept the exclaimation marks as exclaimation marks:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management(SelectedStrategy_Loss, "Before_nLoss", "!urineNLeached!", "PYTHON_9.3", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;g_ESRI_variable_8 = u'!urineNLeached!'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2012 06:02:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362515#M28600</guid>
      <dc:creator>ShaunWeston</dc:creator>
      <dc:date>2012-06-25T06:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python GP Package</title>
      <link>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362516#M28601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Shaun,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any chance you could send me your original tool in a zip file and data necessary to run it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The packaging of script tools does do variable substitution as you have discovered, however it should always run once it becomes a GPK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're seeing an instance where that isn't the case I want to understand why.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're able to share, please send to khibma[@]esri.com&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2012 16:31:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-gp-package/m-p/362516#M28601</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2012-06-25T16:31:28Z</dc:date>
    </item>
  </channel>
</rss>

