<?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: Created Feature Class temporary by default, need to save the mxd to keep it from being gone... in Python AddIns Questions</title>
    <link>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841667#M108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/67060"&gt;Lance Cole&lt;/A&gt;, thanks for&amp;nbsp;the advises, all of those parameters are being taken care of..(arcpy.env.workspace etc..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I uploaded a short video to show you what is going on...I actually never experienced something like that before, I've done many python toolbox before, but this is the first one that&amp;nbsp;does this kind of behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe it's because my main ascript imports many external modules?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I run my script from from pyscripter it works just fine and the FeatureClass created doesn't disappear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help but I dont see anything that could fix this, I'm gonna work on a turn-around for this situation. Like running a 2nd tool that saves the mxd of something like that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Sep 2019 21:14:33 GMT</pubDate>
    <dc:creator>Pier-PhilippeLabrie</dc:creator>
    <dc:date>2019-09-02T21:14:33Z</dc:date>
    <item>
      <title>Created Feature Class temporary by default, need to save the mxd to keep it from being gone...</title>
      <link>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841665#M106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anybody have ever ran into something like that&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run&amp;nbsp;my custom python toolbox, the feature class created in output is not permanent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. The toolbox contains a few import from custom modules, classes etc....&lt;/P&gt;&lt;P&gt;2. The toolbox work perfectly, no error displayed (try, Catch Error etc..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here's what's happening:&lt;/P&gt;&lt;P&gt;- I can see the Feature Class that I just created in the output File Geodatabase (ex: in arcCatalog) and it's also added a layer in the TOC and I can do whatever I want with it (ex: export, run it another toolbox etc...)&lt;/P&gt;&lt;P&gt;- It also has a valid source&lt;/P&gt;&lt;P&gt;But:&lt;/P&gt;&lt;P&gt;- if a quit arcGIS, it won't be there anymore when re-open&lt;/P&gt;&lt;P&gt;- if a save the mxd (hit the save button) it will still be there&lt;/P&gt;&lt;P&gt;- if I save the mxd using arpy.mapping it doesn't stay&lt;/P&gt;&lt;P&gt;So at the end The Feature class is deleted - gone forever if I don't save the mxd with the "save button"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strange isn't it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Aug 2019 05:16:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841665#M106</guid>
      <dc:creator>Pier-PhilippeLabrie</dc:creator>
      <dc:date>2019-08-31T05:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Created Feature Class temporary by default, need to save the mxd to keep it from being gone...</title>
      <link>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841666#M107</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/277011" target="_blank"&gt;Pier-Philippe,&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the tool again. &amp;nbsp;In your Table of Contents, click on the button at the top to list contents by source (normally the second button). &amp;nbsp;Look for your new feature and note the source path. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="458381" alt="TOC" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/458381_Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the data is not saved in the database you are working on the feature is either being created “in-memory”, scratch workspace or in your default GDB depending upon which version of ArcGIS you are using. &amp;nbsp;Since the data persists if you save your MXD, which&amp;nbsp;only saves the reference to the data, &amp;nbsp;I would guess it is one of the later possibilities. &amp;nbsp;You may need to modify your Python script to include setting the &lt;STRONG&gt;arcpy.env.workspace&lt;/STRONG&gt;&amp;nbsp;as part of your code prior to outputting the new feature class. General use of this setting are noted below but will be dependent upon your custom code.&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;# Get the current workspace &lt;/SPAN&gt;
current_Workspace &lt;SPAN class="operator 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;workspace  
  
&lt;SPAN class="comment token"&gt;# Set the workspace environment to local file geodatabase  &lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:/data/base.gdb"&lt;/SPAN&gt;  
  
&lt;SPAN class="comment token"&gt;#set to SDE file  &lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"c:\data\base.sde"&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find the data is being saved in the database you are working on, simply add it back into your MXD using the Add-data button and navigate to the path shown in the TOC next time you need the data. The MXD only stores a reference to the data not the data itself. The data is stored in shapefiles, GDBs, enterprise databases, etc. that are added to a MXD for display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="458382" alt="Add Data" class="jive-emoji jive-image image-2 j-img-original" src="https://community.esri.com/legacyfs/online/458382_Capture.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:16:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841666#M107</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2021-12-12T10:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Created Feature Class temporary by default, need to save the mxd to keep it from being gone...</title>
      <link>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841667#M108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/67060"&gt;Lance Cole&lt;/A&gt;, thanks for&amp;nbsp;the advises, all of those parameters are being taken care of..(arcpy.env.workspace etc..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I uploaded a short video to show you what is going on...I actually never experienced something like that before, I've done many python toolbox before, but this is the first one that&amp;nbsp;does this kind of behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe it's because my main ascript imports many external modules?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I run my script from from pyscripter it works just fine and the FeatureClass created doesn't disappear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help but I dont see anything that could fix this, I'm gonna work on a turn-around for this situation. Like running a 2nd tool that saves the mxd of something like that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2019 21:14:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841667#M108</guid>
      <dc:creator>Pier-PhilippeLabrie</dc:creator>
      <dc:date>2019-09-02T21:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Created Feature Class temporary by default, need to save the mxd to keep it from being gone...</title>
      <link>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841668#M109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's the youttube link to the video in case it didn't work...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=khgbjFG7_rs&amp;amp;feature=youtu.be"&gt;https://www.youtube.com/watch?v=khgbjFG7_rs&amp;amp;feature=youtu.be&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2019 21:17:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-addins-questions/created-feature-class-temporary-by-default-need-to/m-p/841668#M109</guid>
      <dc:creator>Pier-PhilippeLabrie</dc:creator>
      <dc:date>2019-09-02T21:17:54Z</dc:date>
    </item>
  </channel>
</rss>

