<?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: ArcToolbox script will not return values in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517608#M40565</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Code is absolutely fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect you dont have a title in your map document. If you dont have a title, mxd.title will equal ''.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case the AddMessage doesn't return anything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The title it is returning is from:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;File &amp;gt; Map Document Properties &amp;gt; Title: ________&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you be sure you got something in there?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also as a check, take your code into the Python window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("current")
mxd.title&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;(the arcpy.AddMessage isn't going to do what you want in the Py Window&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:34:30 GMT</pubDate>
    <dc:creator>KevinHibma</dc:creator>
    <dc:date>2021-12-11T22:34:30Z</dc:date>
    <item>
      <title>ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517606#M40563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay most of that stuff in here before was redundant so it seems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;New toolbox, new Script.&amp;nbsp; No changes made to validation.&amp;nbsp; No input at all.&amp;nbsp; Just a straight run of the script does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument("current")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.AddMessage(mxd.title)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully that is a bit easier to answer cos I reckon I must be missing something really, really simple.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Sep 2011 08:16:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517606#M40563</guid>
      <dc:creator>HenryColgate</dc:creator>
      <dc:date>2011-09-06T08:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517607#M40564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Okay most of that stuff in here before was redundant so it seems.&lt;BR /&gt;&lt;BR /&gt;New toolbox, new Script.&amp;nbsp; No changes made to validation.&amp;nbsp; No input at all.&amp;nbsp; Just a straight run of the script does not work.&lt;BR /&gt;&lt;BR /&gt;import arcpy&lt;BR /&gt;mxd = arcpy.mapping.MapDocument("current")&lt;BR /&gt;arcpy.AddMessage(mxd.title)&lt;BR /&gt;&lt;BR /&gt;Hopefully that is a bit easier to answer cos I reckon I must be missing something really, really simple.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on what I see here, you are missing something really simple: a single line of code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.GetMessages()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 17:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517607#M40564</guid>
      <dc:creator>PhilMorefield</dc:creator>
      <dc:date>2011-09-08T17:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517608#M40565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Code is absolutely fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect you dont have a title in your map document. If you dont have a title, mxd.title will equal ''.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case the AddMessage doesn't return anything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The title it is returning is from:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;File &amp;gt; Map Document Properties &amp;gt; Title: ________&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you be sure you got something in there?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also as a check, take your code into the Python window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("current")
mxd.title&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;(the arcpy.AddMessage isn't going to do what you want in the Py Window&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:34:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517608#M40565</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2021-12-11T22:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517609#M40566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Code is absolutely fine.&lt;BR /&gt;I suspect you dont have a title in your map document. If you dont have a title, mxd.title will equal ''.&lt;BR /&gt;In this case the AddMessage doesn't return anything.&lt;BR /&gt;&lt;BR /&gt;The title it is returning is from:&lt;BR /&gt;File &amp;gt; Map Document Properties &amp;gt; Title: ________&lt;BR /&gt;&lt;BR /&gt;Can you be sure you got something in there?&lt;BR /&gt;Also as a check, take your code into the Python window.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("current")
mxd.title&lt;/PRE&gt;&lt;BR /&gt;(the arcpy.AddMessage isn't going to do what you want in the Py Window&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on my reading of his description, it looks like he's trying to run this as a script tool, not from the Python window. Hence, he would need arcpy.GetMessages() to return the document title to the geoprocessing window.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:34:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517609#M40566</guid>
      <dc:creator>PhilMorefield</dc:creator>
      <dc:date>2021-12-11T22:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517610#M40567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, just needed to add the info there in File... Map Docuemnt Properties... Title&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought it was getting pulled straight from the file name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 07:15:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517610#M40567</guid>
      <dc:creator>HenryColgate</dc:creator>
      <dc:date>2011-09-09T07:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517611#M40568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Based on my reading of his description, it looks like he's trying to run this as a script tool, not from the Python window. Hence, he would need arcpy.GetMessages() to return the document title to the geoprocessing window.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.GetMessages is specific to getting messages from a tool which has executed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/GetMessages/000v0000000p000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/GetMessages/000v0000000p000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 15:08:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517611#M40568</guid>
      <dc:creator>KevinHibma</dc:creator>
      <dc:date>2011-09-09T15:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: ArcToolbox script will not return values</title>
      <link>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517612#M40569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;arcpy.GetMessages is specific to getting messages from a tool which has executed.&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/GetMessages/000v0000000p000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/GetMessages/000v0000000p000000/&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, this is a digression, but that link is a bit misleading. You can put whatever you want into a message. For example, if you put this code into a script tool:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.AddMessage("This is just a message...")
arcpy.AddWarning("This text is green...")
arcpy.AddError("This text is red...")
arcpy.GetMessages()

# this will make the tool bomb out
foo = bar&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No tools have executed but you've still returned three messages.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:34:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arctoolbox-script-will-not-return-values/m-p/517612#M40569</guid>
      <dc:creator>PhilMorefield</dc:creator>
      <dc:date>2021-12-11T22:34:35Z</dc:date>
    </item>
  </channel>
</rss>

