<?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 Python window keep giving error message from last operation in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385419#M30387</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am brand new to Python as of today. I cannot believe that ESRI is replacing VBA with full intellisense for this silly DOS window thing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, if I run this code in the Python window in ArcMap:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
def happyBirthday(person):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Happy Birthday " + person + ".")

happyBirthday('emily')
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It runs fine. But then when I run this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, os
def prinnames(sPath);
import arcpy, os
 folderPath = sPath
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in os.listdir(folderPath):
&amp;nbsp;&amp;nbsp; fullpath = os.path.join(folderPath, filename)
&amp;nbsp;&amp;nbsp; if os.path.isfile(fullpath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; basename, extension = os.path.splitext(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if extension.lower() == ".mxd":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(mxd.title)
prinnames("C:\Gareth\mystuff")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Parsing error &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (line 2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But then, when I try to go back and paste the exact same code back into the window that ran before (The "Happy Birthday" test code), it won't run, instead it gives me the exact same error it had before (Parsing error &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (line 2))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So why is it doing this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Dec 2012 19:36:33 GMT</pubDate>
    <dc:creator>GarethMann</dc:creator>
    <dc:date>2012-12-13T19:36:33Z</dc:date>
    <item>
      <title>Python window keep giving error message from last operation</title>
      <link>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385419#M30387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am brand new to Python as of today. I cannot believe that ESRI is replacing VBA with full intellisense for this silly DOS window thing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, if I run this code in the Python window in ArcMap:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
def happyBirthday(person):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Happy Birthday " + person + ".")

happyBirthday('emily')
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It runs fine. But then when I run this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, os
def prinnames(sPath);
import arcpy, os
 folderPath = sPath
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in os.listdir(folderPath):
&amp;nbsp;&amp;nbsp; fullpath = os.path.join(folderPath, filename)
&amp;nbsp;&amp;nbsp; if os.path.isfile(fullpath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; basename, extension = os.path.splitext(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if extension.lower() == ".mxd":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(mxd.title)
prinnames("C:\Gareth\mystuff")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Parsing error &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (line 2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But then, when I try to go back and paste the exact same code back into the window that ran before (The "Happy Birthday" test code), it won't run, instead it gives me the exact same error it had before (Parsing error &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (line 2))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So why is it doing this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Dec 2012 19:36:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385419#M30387</guid>
      <dc:creator>GarethMann</dc:creator>
      <dc:date>2012-12-13T19:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python window keep giving error message from last operation</title>
      <link>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385420#M30388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Gareth,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What version of ArcGIS (including Service Packs) are you running?&amp;nbsp; I was unable to reproduce this using ArcGIS 10.1 SP1.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Dec 2012 19:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385420#M30388</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2012-12-13T19:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python window keep giving error message from last operation</title>
      <link>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385421#M30389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I am brand new to Python as of today. I cannot believe that ESRI is replacing VBA with full intellisense for this silly DOS window thing.&lt;BR /&gt;&lt;BR /&gt;Anyway, if I run this code in the Python window in ArcMap:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def happyBirthday(person):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Happy Birthday " + person + ".")

happyBirthday('emily')
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;It runs fine. But then when I run this code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, os
def prinnames(sPath);
import arcpy, os
 folderPath = sPath
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in os.listdir(folderPath):
&amp;nbsp;&amp;nbsp; fullpath = os.path.join(folderPath, filename)
&amp;nbsp;&amp;nbsp; if os.path.isfile(fullpath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; basename, extension = os.path.splitext(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp; if extension.lower() == ".mxd":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(fullpath)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(mxd.title)
prinnames("C:\Gareth\mystuff")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I get this error:&lt;BR /&gt;&lt;BR /&gt;Parsing error &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (line 2)&lt;BR /&gt;&lt;BR /&gt;But then, when I try to go back and paste the exact same code back into the window that ran before (The "Happy Birthday" test code), it won't run, instead it gives me the exact same error it had before (Parsing error &amp;lt;type 'exceptions.SyntaxError'&amp;gt;: invalid syntax (line 2))&lt;BR /&gt;&lt;BR /&gt;So why is it doing this?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looks like you are using a semi-colon instead of a colon in your first line. Not sure why it won't run the previous code afterwards.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def prinnames(sPath);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385421#M30389</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-11T17:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python window keep giving error message from last operation</title>
      <link>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385422#M30390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the prompt responses guys.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using ArcMap 10.0, not sure which service pack. All of a sudden the problem I was having went away. Not sure why, and thanks mzcoyle, that was in fact the problem with my code, so it is now fixed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next time that problem occurs I will post here again and maybe include a screen shot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Dec 2012 19:58:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-window-keep-giving-error-message-from-last/m-p/385422#M30390</guid>
      <dc:creator>GarethMann</dc:creator>
      <dc:date>2012-12-13T19:58:33Z</dc:date>
    </item>
  </channel>
</rss>

