<?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: How to run python script without opening the mxd? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-run-python-script-without-opening-the-mxd/m-p/133227#M10381</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bart,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sounds like you have found a bug? Alternatively (although not tested by me) is you could create the event layer using the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;arcpy.MakeXYEventLayer_management&lt;/SPAN&gt;&lt;SPAN&gt; tool from the table as you know what the table is called and never have the need to "enter" the MXD?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just an idea...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Jul 2011 09:48:54 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2011-07-22T09:48:54Z</dc:date>
    <item>
      <title>How to run python script without opening the mxd?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-run-python-script-without-opening-the-mxd/m-p/133226#M10380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Howdie, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I just wrote my first python script that copies an even layer to a shp (yay!). It works fine when I run it in python window with the mxd already open. However, if I run the code without&amp;nbsp; opening the mxd, I get the dataset "does not exist" error message, and if I run it outside of ArcMap entirely, I get a bunch of error messages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ultimately, I want to schedule a task that runs the python script like an executable. I understand that the first case is probably due to the fact that I don't have a full path, but it is an event layer, so I am not sure what to put in the path.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
#set the overwrite option
arcpy.env.overwriteOutput = 'true'
#define the mxd
mxd = arcpy.mapping.MapDocument(r"G:\Temp\Bart\mxds\Parcel_map.mxd")
#copy specified layer to a new shapefile
arcpy.CopyFeatures_management("Transfer Status","G:\Temp\Bart\Shapefiles\PyTest6.shp")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 23:07:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-run-python-script-without-opening-the-mxd/m-p/133226#M10380</guid>
      <dc:creator>BartKowalski</dc:creator>
      <dc:date>2011-07-21T23:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to run python script without opening the mxd?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-run-python-script-without-opening-the-mxd/m-p/133227#M10381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bart,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sounds like you have found a bug? Alternatively (although not tested by me) is you could create the event layer using the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;arcpy.MakeXYEventLayer_management&lt;/SPAN&gt;&lt;SPAN&gt; tool from the table as you know what the table is called and never have the need to "enter" the MXD?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just an idea...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 09:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-run-python-script-without-opening-the-mxd/m-p/133227#M10381</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2011-07-22T09:48:54Z</dc:date>
    </item>
  </channel>
</rss>

