<?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: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9405#M759</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/package-project.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/package-project.htm"&gt;Package Project—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it seems some of your paths are to your folder and even if you are sharing internally, I doubt that anyone has access to it.&amp;nbsp; You should consolidate all the data, scripts etc into the folder structure that you are packaging.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Connections—such as folder, server, database and workflow—will only be included in an internal package. These items are removed if the package is created to be shared outside your organization.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Aug 2018 02:28:49 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-08-12T02:28:49Z</dc:date>
    <item>
      <title>Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9404#M758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a surprise to me that ArcGIS Pro changes the python code in my script tool when I pack the&amp;nbsp;project and upload the ppkx to ArcGIS Online.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the&amp;nbsp;first a few lines of code for one script tool in the unpacked ppkx, please pay attention to the codes between "Esri start of added imports" and "Esri end of added variables"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Esri start of added imports&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; sys&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; arcpy
&lt;SPAN class="comment token"&gt;# Esri end of added imports&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Esri start of added variables&lt;/SPAN&gt;
g_ESRI_variable_1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"EventID = '{}'"&lt;/SPAN&gt;
g_ESRI_variable_2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;scriptWorkspace&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;'&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;\\&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;\\&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;\\Users\\simoxu
\\AppData\\Local\\Esri\\ArcGISPro\\Staging\\SharingProcesses\\&lt;SPAN class="number token"&gt;0038&lt;/SPAN&gt;
\\RDA Tools &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; ArcGIS Pro\\p20\\current_checkout_attachments'&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Esri end of added variables&lt;/SPAN&gt;

 &lt;SPAN class="comment token"&gt;#-------------------------------------------------------------------------------&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Name:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rda_checkout&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Purpose:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; checkout the assessment for a specific event and map it&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Author:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; simoxu&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Created:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 27/07/2018&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#-------------------------------------------------------------------------------&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcpy &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; da
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;sys
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; shutil
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In one place in my original code, I have the following line:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;checkout_image_path&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;homefolder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"current_checkout_attachments"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it was replaced with the following code, which is causing fatal error for the tool itself.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;checkout_image_path&lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;homefolder&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;g_ESRI_variable_2&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's quite strange that ArcGIS Pro packaging tool will&amp;nbsp;change&amp;nbsp;my code without informing me ---&amp;nbsp; I only found out this when I shared the project package with others and then was told the tools could not run properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it only me? Any advice?&lt;/P&gt;&lt;P&gt;I am using ArcGIS Pro 2.2.1, by the way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:55:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9404#M758</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2021-12-10T19:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9405#M759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/package-project.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/package-project.htm"&gt;Package Project—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it seems some of your paths are to your folder and even if you are sharing internally, I doubt that anyone has access to it.&amp;nbsp; You should consolidate all the data, scripts etc into the folder structure that you are packaging.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #4c4c4c; font-family: 'Avenir Next W01','Avenir Next W00','Avenir Next','Avenir','Helvetica Neue',sans-serif; font-size: 15.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Connections—such as folder, server, database and workflow—will only be included in an internal package. These items are removed if the package is created to be shared outside your organization.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Aug 2018 02:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9405#M759</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-12T02:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9406#M760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan.&lt;/P&gt;&lt;P&gt;That's the problem ---&amp;nbsp; ESRI-added variable points to my folder which no one else can access. My question is, why does the Package Project tool do this? it seems the tool is confused by my code, somehow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand the Package Project tool will analyze my custom tool before consolidating the required resources, so I manually used the Analyze Tools for Pro to analyze my script, and there are no related issues reported in result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see in my code, I am creating a path using os.path.join() function, the second parameter is a string (folder name) which is replaced by an ESRI-added variable ---- what? I am using a string, a CONSTANT, why changed it to a variable?&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/confused.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 01:06:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9406#M760</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-08-13T01:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9407#M761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;os&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;path&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;join&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;env&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;scriptWorkspace&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position-x: 0%; background-position-y: 0%; background-repeat: repeat; background-size: auto; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; color: #999999; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; outline-color: invert; outline-style: none; outline-width: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; vertical-align: baseline; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px; padding: 0px; margin: 0px; border: 0px none #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;\\&lt;EM&gt;&lt;STRONG&gt;Users\\simoxu &lt;/STRONG&gt;&lt;/EM&gt;….. isn't that you?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;Your workspace should be in the same folder as your whole project&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;c:\MyProjects\&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt; \my.aprx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt; \mydata.gdb&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt; \myscratch.gdb&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt; \myscripts&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #000000; font-family: monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px #fff; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt; \the_script.py&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 01:59:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9407#M761</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-13T01:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9408#M762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The packaging is really making the tool ready for server. It should keep paths that are registered in the server and try to replace others since the server does not have access to them. In your case I think it try to pack everything since the package should be self contained and should not use&amp;nbsp;any other paths. Sometime the only way with server is to edit the result script. You can try to unzip, fix the script and zip again but this is not supported!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have Fun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 04:46:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9408#M762</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2018-08-13T04:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9409#M763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am pretty sure all the&amp;nbsp;workspaces I use in the project are all under the same project folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The absolute path pointing to "..\\users\\simoxu...." were added in the front of my code by ArcGIS Pro Package Project tool / function, I am quite puzzled by this behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because it is pointing to "&lt;STRONG style="background-color: #ffffff; color: #4c4c4c; font-size: 12px;"&gt;&lt;EM&gt;C:\Users\&amp;lt;USERPROFILE&amp;gt;\AppData\Local\ESRI\ArcGISPro\Staging\SharingProcesses/..."&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-size: 15px;"&gt; and this folder seems related to the sharing activity, I'll see whether or not this behavior has anything to do with caching.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 04:49:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9409#M763</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-08-13T04:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9410#M764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That makes sense.&lt;/P&gt;&lt;P&gt;I remember someone reported the similar issue when publishing a custom Geoprocessing to the server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But my case is really about sharing a project with other team mates, all the tools are designed to run on the local machine rather than run as a web service.&amp;nbsp; After they download it (or open it from portal/ArcGIS Online directly), the project folder structure are guaranteed and all the references to the datasource and Online resources should be ready to use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 04:59:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9410#M764</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-08-13T04:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9411#M765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;from&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/package-project.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/package-project.htm"&gt;Package Project—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;did you remove the history?&lt;/P&gt;&lt;P&gt;And I would make sure that you have no reference to your folders as either a data source or a data destination since that will cause the tool to fail if people in your organization don't have access to, or permission to use, it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 10:13:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9411#M765</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-13T10:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9412#M766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I removed the history completely. I seriously think this is a bug in the Package Project tool.&lt;/P&gt;&lt;P&gt;It makes sense to analyze the code when you publish the geoprocessing tool as a service and make sure all the folders used in the code are accessible by the server, But as a project package, this process is not needed and the folders are relative to the project folder, which will be created when you unpack the project in ArcGIS Pro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 03:04:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9412#M766</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-08-14T03:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9413#M767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree... it is that user folder with your name that still bugs me... don't know why it appears, unless your data were in it or it belongs to history&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2018 03:11:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9413#M767</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-08-14T03:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9414#M768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A bug related to this topic has been confirmed by ESRI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8; font-weight: 300;"&gt;#BUG-000116650&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8; font-weight: 300;"&gt;Python script within the default toolbox in a project is appended with an invalid directory path after sharing the project as a project package.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2018 06:42:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9414#M768</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-09-11T06:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9415#M769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/10807"&gt;simo xu&lt;/A&gt;‌, do you have any info about the similar issue when publishing a custom geoprocessing service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 May 2020 00:26:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9415#M769</guid>
      <dc:creator>DanMcCoy</dc:creator>
      <dc:date>2020-05-09T00:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9416#M770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I found it...&lt;BR /&gt;&lt;A href="https://community.esri.com/thread/207534-why-does-arcgis-server-change-path-variable-to-gesrivariable1"&gt;https://community.esri.com/thread/207534-why-does-arcgis-server-change-path-variable-to-gesrivariable1&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 May 2020 00:30:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/9416#M770</guid>
      <dc:creator>DanMcCoy</dc:creator>
      <dc:date>2020-05-09T00:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script are changed by ESRI with g_ESRI_variable_1, g_ESRI_variable_2</title>
      <link>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/1557088#M73168</link>
      <description>&lt;P&gt;I know this thread is very old, but I thought I'd pass along some info related to it because I've just gone through a couple of days dealing with this too. I only just found the addition of a "g_ESRI_variable_1" variable to a script in a Project Package I had created because I was testing it to ensure what I had in mind would work. It didn't and I've spent two days trying to figure out why, but that's beside the point. I know now.&lt;/P&gt;&lt;P&gt;When I finally did stumble on this&amp;nbsp;"g_ESRI_variable_1", I was reminded that I had run into the exact same problem about 10-15 years ago with ArcGIS Server 9.3 and again with 10.1. At both times, I was struggling with getting Geoprocessing Services to run properly after publishing. Eventually, looking into the v101 folder on the server, I discovered what ArcGIS Server was doing to the code during the publishing process each time. And each time, fixed the problems by "over-complicating" the things that the ArcGIS Server was changing erroneously. You'll get the idea in a moment. My point is that this is not a new problem only related to Pro. It's been in their source code for a while and they seem to feel it's a good thing to change code without informing the user. Otherwise, they would have done something about it by now.&lt;/P&gt;&lt;P&gt;What I've been struggling with over the last couple of days is that I have a project with scripts that I am putting in source control as a project package. The project's name is "my_project_name" and the first thing each script within it does when invoked is verify that it is running within the "my_project_name" project because that project is structurally set up as it needs to be for all of these scripts to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, ArcGIS Pro is finding this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;project_name = "my_project_name"
aprx = arcpy.mp.ArcGISProject("CURRENT")
pos = aprx.filePath.rfind(project_name)
if pos &amp;lt; 0:
        arcpy.AddError("This script must be run within the '" + project_name + "' ArcGIS Pro project.")
        sys.exit()&lt;/LI-CODE&gt;&lt;P&gt;The project_name variable is used for many things within the scripts and ArcGIS Pro is changing them all to use g_ESRI_variable_1 because the project_name variable is instantiated with a string that is the same project name that the ppks file explodes to:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;g_ESRI_variable_1 = os.path.join(arcpy.env.scriptWorkspace,'..\\commondata\\my_project_name1')&lt;/LI-CODE&gt;&lt;P&gt;Once I realized that was the problem, and recognized it was the same problem I'd beaten my head against the wall over (repeatedly) many years ago, I intro'd the same fix I did then. I "hid" the string in question by complicating the code so ESRI stopped trying to "fix" it for me. So, now I have:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# project_name = "my_project_name"   # doesn't work
project_name = "_".join(["my","project","name"])&lt;/LI-CODE&gt;&lt;P&gt;Et voila.&lt;/P&gt;&lt;P&gt;Similarly, though not for this particular problem, but in previous ones, we got around some of the problems by providing our paths with "/" rather the "\" and using Python's os.path.normpath functionality to convert the code to Windows structure at run time. ArcGIS wouldn't change those or the ones when we built the paths using the os.path.join (or path.pathlib.join_path, now) but there had to be enough parameters passed that ArcGIS couldn't figure out the path. I'm guessing, then, that the reporter of this problem could probably try something like this (no testing, just off the top of my head) to break things up and confuse ArcGIS Pro enough that it wouldn't try to change the script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# checkout_image_path= os.path.join(homefolder,"current_checkout_attachments")‍‍
checkout_image_path= os.path.normpath(homefolder) + r"\\current_checkout_attachments")‍‍&lt;/LI-CODE&gt;&lt;P&gt;Anyway, just throwing this stuff out there in case someone else comes across this thread looking for ideas.&lt;/P&gt;&lt;P&gt;Good luck!!&lt;/P&gt;&lt;P&gt;jtm&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2024 02:47:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-are-changed-by-esri-with-g-esri-variable-1/m-p/1557088#M73168</guid>
      <dc:creator>myESRIUName</dc:creator>
      <dc:date>2024-11-09T02:47:11Z</dc:date>
    </item>
  </channel>
</rss>

