<?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: Command Prompt ArcGIS 10.2 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667510#M51835</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I just exported a python script (From Model Builder) and put it into an open source text editor called "Jedit". I created a batch file with the following command (cmd/k W:\GIS_Scripts\Test\Example.py) and saved it as Run.bat. When i double click to run the .bat file, the command prompt window open with the location of the python file on the first line and then nothing after. Also when i double click the .bat file, a wordpad document opens and contains all my script's syntax. I an using 10.2, but all of my commands in the script use ArcGIS tools such as copy, append, ect. Before on 9.3 i would run the batch file and it would run fine within the command prompt window. Any ideas why it wont run in 10.2?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Feb 2014 13:27:59 GMT</pubDate>
    <dc:creator>AndrewTuleya1</dc:creator>
    <dc:date>2014-02-27T13:27:59Z</dc:date>
    <item>
      <title>Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667508#M51833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the past I have used command prompt to run batch files that consist of Python Commands with ArcGIS tools. From what I understand you are no longer able to do so with 10.2. Has anyone else experienced this or figured out a work around besides the python window?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 12:49:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667508#M51833</guid>
      <dc:creator>AndrewTuleya1</dc:creator>
      <dc:date>2014-02-27T12:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667509#M51834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What error are you getting? Try reading through this if you are having issues.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2/faq/windows"&gt;http://docs.python.org/2/faq/windows&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 13:09:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667509#M51834</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2014-02-27T13:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667510#M51835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I just exported a python script (From Model Builder) and put it into an open source text editor called "Jedit". I created a batch file with the following command (cmd/k W:\GIS_Scripts\Test\Example.py) and saved it as Run.bat. When i double click to run the .bat file, the command prompt window open with the location of the python file on the first line and then nothing after. Also when i double click the .bat file, a wordpad document opens and contains all my script's syntax. I an using 10.2, but all of my commands in the script use ArcGIS tools such as copy, append, ect. Before on 9.3 i would run the batch file and it would run fine within the command prompt window. Any ideas why it wont run in 10.2?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 13:27:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667510#M51835</guid>
      <dc:creator>AndrewTuleya1</dc:creator>
      <dc:date>2014-02-27T13:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667511#M51836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should be able to execute python commands from Command Prompt with any version of ArcGIS.&amp;nbsp; If you see that your python scripts are opening with wordpad, the problem may be that you have wordpad set as your default program to open *.py files. I would say that you'd want to try doing one of the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Add the C:\Python27\ArcGIS10.2 folder to your system's path variable and call the script generated from modelbuilder as such in your batch file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;python "c:\Path\To\Script.py"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Use the full path to the python executable in your batch file when calling the scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;C:\Python27\ArcGIS10.2\python.exe "c:\Path\To\Script.py"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On a side note, you may want to note that exporting a script from ModelBuilder doesn't guarantee that the model will work.&amp;nbsp; This workflow should be used to create the "skeleton" for what your code would look like and you should always go through this output and refactor the code before executing it.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the most part, a quick test to check if you model is suitable for running outside of ArcMap would be to run it from the ArcCatalog application.&amp;nbsp; This will ensure that you're not using any in-memory features in your model that are only available to the Map Document.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 14:26:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667511#M51836</guid>
      <dc:creator>FreddieGibson</dc:creator>
      <dc:date>2014-02-27T14:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667512#M51837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the input, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The tools that I am using in Model Builder work fine outside of catalog or a map document. This problem only started to occur when i got a new computer and downloaded 10.2 and am not longer using 9.3.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 15:55:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667512#M51837</guid>
      <dc:creator>AndrewTuleya1</dc:creator>
      <dc:date>2014-02-27T15:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667513#M51838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not sure if I am following. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the path of my script&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;W:\GIS_Scripts\Test\Example.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the path of my batch file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;W:\GIS_Scripts\Test\Run.bat&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the line in my batch file to run the command&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cmd/k W:\GIS_Scripts\Test\Example.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure what you recommend doing with C:\Python27\ArcGIS10.2\python.exe?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 16:04:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667513#M51838</guid>
      <dc:creator>AndrewTuleya1</dc:creator>
      <dc:date>2014-02-27T16:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Command Prompt ArcGIS 10.2</title>
      <link>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667514#M51839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you're looking to exectue a Python script on your system, but don't want to mess with or don't have access to your system path variables, here's a way to execute the Python script through your batch file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;start C:\Python27\ArcGIS10.2\python.exe C:\Path\To\Script\myScript.py
PAUSE&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It will open up the Python command window, so I'd recommend wrapping your script in something like this to keep the window open for error checking and printing outputs to the console:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import traceback

try:

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Your script here
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; traceback.print_exc()

finally:
&amp;nbsp;&amp;nbsp;&amp;nbsp; raw_input("Press any key to close this window")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:12:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/command-prompt-arcgis-10-2/m-p/667514#M51839</guid>
      <dc:creator>MattEiben</dc:creator>
      <dc:date>2021-12-12T04:12:25Z</dc:date>
    </item>
  </channel>
</rss>

