<?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: Prevent creation of XML files for geoprocessing results in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394973#M13430</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;An easier fix that I discovered would be to turn off the logging history by using the line:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;arcpy.SetLogHistory(False)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;The documentation for its use can be found here:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;&lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/setloghistory.htm" title="https://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/setloghistory.htm"&gt;SetLogHistory—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;Hope it works for you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Oct 2019 18:25:58 GMT</pubDate>
    <dc:creator>ChigoZeerem</dc:creator>
    <dc:date>2019-10-16T18:25:58Z</dc:date>
    <item>
      <title>Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394966#M13423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a Python script that I use to create a text file containing the list of files in a folder for example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The name of the output text file is one of the parameters of the tool and needs to be defined with Direction = Output (otherwise the tool complains that the file does not exist). The consequence is that a description file (an .xml file) is created by ArcGIS once the tool has finished running.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to prevent ArcGIS from creating this .xml file?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2013 08:38:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394966#M13423</guid>
      <dc:creator>JosephBarraud</dc:creator>
      <dc:date>2013-05-03T08:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394967#M13424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If that's happening, it sounds like you're using an ArcGIS tool or arcpy command to create the text file?? ArcGIS often keeps metadata on its datasets in xml files. I'd switch to using Python's built-in open() function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with open("filename.txt", "w") as f:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("my_list_of_files_as_a_string")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 May 2013 05:51:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394967#M13424</guid>
      <dc:creator>DavidMartin</dc:creator>
      <dc:date>2013-05-04T05:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394968#M13425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply. But I am doing exactly what you've suggested. I have a "with open(...) as f:" command and the script is almost pure Python. I am using arcpy only for the GUI.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have even tried to delete the XML file within the script but this file is actually created after the tool has finished running.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 05:38:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394968#M13425</guid>
      <dc:creator>JosephBarraud</dc:creator>
      <dc:date>2013-05-07T05:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394969#M13426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would look more closely at what you are doing with arcpy, in that case. I have just created the script below, and from it built a script tool with a single output parameter (a file). When I run it, I don't find an xml file is created, only my text file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

with open("e:\\filename.txt", "w") as f:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write("my_list_of_files_as_a_string")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SetParameter(0, f)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:05:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394969#M13426</guid>
      <dc:creator>DavidMartin</dc:creator>
      <dc:date>2021-12-11T18:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394970#M13427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have got my answer then: using "SetParameter" does prevent the creation of the XML file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a simplified version of my original code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import system modules
import os

# Import ArcGIS module
import arcpy

# Get the parameters
folderName = arcpy.GetParameterAsText(0)
destTxtFile = arcpy.GetParameterAsText(1)

# Create list of files in the directory
listFiles = os.listdir(folderName)

# Open output txt file
with open(destTxtFile,'w') as txtfile:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop through the list of files
&amp;nbsp;&amp;nbsp;&amp;nbsp; for fileName in listFiles:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; baseName = os.path.basename(fileName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (nameRoot,ext) = os.path.splitext(baseName)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ext == ".asc":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; txtfile.write(baseName)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.SetParameter(1, txtfile)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does create an XML file along with the text file. If I uncomment the last line, the XML file has gone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394970#M13427</guid>
      <dc:creator>JosephBarraud</dc:creator>
      <dc:date>2021-12-11T18:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394971#M13428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Interesting. I wonder if this is version-specific? If I run your script (with or without the SetParameter line commented out), I don't get an xml file created - just a text file. I'm on 10.1 SP1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Even if I change the type of the output parameter in the script tool to "Dataset" or "Table", I still don't get an xml file generated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Glad you're sorted though!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 09:57:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394971#M13428</guid>
      <dc:creator>DavidMartin</dc:creator>
      <dc:date>2013-05-07T09:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394972#M13429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There might be an option somewhere I have turned on or something like that... I am also running ArcGIS for Desktop Basic 10.1 SP1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried File, Text File and Dataset for the type of the output in the tool, with the same result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To be complete, this tool was part of a standard toolbox, not a "Python toolbox".&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 10:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394972#M13429</guid>
      <dc:creator>JosephBarraud</dc:creator>
      <dc:date>2013-05-07T10:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent creation of XML files for geoprocessing results</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394973#M13430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;An easier fix that I discovered would be to turn off the logging history by using the line:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;arcpy.SetLogHistory(False)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;The documentation for its use can be found here:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;&lt;A class="link-titled" href="https://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/setloghistory.htm" title="https://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/setloghistory.htm"&gt;SetLogHistory—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;Hope it works for you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fefefe;"&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Oct 2019 18:25:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/prevent-creation-of-xml-files-for-geoprocessing/m-p/394973#M13430</guid>
      <dc:creator>ChigoZeerem</dc:creator>
      <dc:date>2019-10-16T18:25:58Z</dc:date>
    </item>
  </channel>
</rss>

