<?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 overwriteOutput - beginner question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62288#M5002</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to adapt a script I found on ArcGIS Resource Center (Thanks ArcGIS Resource Center!). The script exports a pdf from an mxd. Currently if a pdf already exists with the same name it is overwritten - I would like it NOT to do this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The relevant line of code is: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.overWriteOutput = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried combinations of the following but can't get this to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed 1 to 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed 1 to False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed case of function to overwriteOutput&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed to arcpy.env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also noticed that in the ArcMap Python interactive window if I type in arcpy.env.o to get the correct syntax/help both overWriteOutput and overwriteOutput are listed and in the help window one produces the word True and the other False!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Going slightly crazy now!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone tell me what I am doing wrong or suggest another way to stop the file being overwritten.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Oct 2011 16:55:39 GMT</pubDate>
    <dc:creator>TimothieBiggs</dc:creator>
    <dc:date>2011-10-20T16:55:39Z</dc:date>
    <item>
      <title>overwriteOutput - beginner question</title>
      <link>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62288#M5002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello -&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to adapt a script I found on ArcGIS Resource Center (Thanks ArcGIS Resource Center!). The script exports a pdf from an mxd. Currently if a pdf already exists with the same name it is overwritten - I would like it NOT to do this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The relevant line of code is: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.overWriteOutput = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried combinations of the following but can't get this to work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed 1 to 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed 1 to False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed case of function to overwriteOutput&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;changed to arcpy.env&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also noticed that in the ArcMap Python interactive window if I type in arcpy.env.o to get the correct syntax/help both overWriteOutput and overwriteOutput are listed and in the help window one produces the word True and the other False!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Going slightly crazy now!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone tell me what I am doing wrong or suggest another way to stop the file being overwritten.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 16:55:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62288#M5002</guid>
      <dc:creator>TimothieBiggs</dc:creator>
      <dc:date>2011-10-20T16:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: overwriteOutput - beginner question</title>
      <link>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62289#M5003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can use conditional statements to check if a file exists:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
import arcpy
file = r"somepath\pdf.pdf"
if os.path.isfile(file): # exists - get a new name for the pdf
&amp;nbsp;&amp;nbsp; file = arcpy.CreateUniqueName(file)
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The if state basically is saying if the file exists and the os.path.isfile() returns true, then call this ArcPy function that will create a unique name for your file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, to set overwrite output it should be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.overwriteOutput = True # or 1
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:22:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62289#M5003</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-10T22:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: overwriteOutput - beginner question</title>
      <link>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62290#M5004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Super. Thanks Andrew!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Oct 2011 19:44:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/overwriteoutput-beginner-question/m-p/62290#M5004</guid>
      <dc:creator>TimothieBiggs</dc:creator>
      <dc:date>2011-10-20T19:44:28Z</dc:date>
    </item>
  </channel>
</rss>

