<?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: Strange string truncation in ArcToolbox in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54995#M4335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;did you try this for your replace?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;filename.replace("\\", "/")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Oct 2011 12:42:36 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2011-10-10T12:42:36Z</dc:date>
    <item>
      <title>Strange string truncation in ArcToolbox</title>
      <link>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54994#M4334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a simple Python script, which should check if a text file exists, and if not, create it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;filename = "%s\\%s.sql" % (sqlDir,viewName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.AddMessage("Sql file: " + filename)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if not os.path.exists(filename):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; ecc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running the script from an IDE (I use PyScripter) it works fine (the debugger also displays correctly the filename) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Running it from the ArcToolbox, the directory part of the file path is removed, i.e. gp.AddMessage("Sql file: " + filename) prints only "\\viewName", so the line &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if not os.path.exists(filename):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone explain me why this weired behaviour ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 12:21:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54994#M4334</guid>
      <dc:creator>pierocavalieri</dc:creator>
      <dc:date>2011-10-10T12:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Strange string truncation in ArcToolbox</title>
      <link>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54995#M4335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;did you try this for your replace?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;filename.replace("\\", "/")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 12:42:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54995#M4335</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2011-10-10T12:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Strange string truncation in ArcToolbox</title>
      <link>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54996#M4336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, it was my mystake. When using: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.GetParameterAsText(pos_dir)&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pos_dir was not correct (but was correct in PyScripter...)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Piero&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 12:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/strange-string-truncation-in-arctoolbox/m-p/54996#M4336</guid>
      <dc:creator>pierocavalieri</dc:creator>
      <dc:date>2011-10-10T12:53:39Z</dc:date>
    </item>
  </channel>
</rss>

