<?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: Difference: Project Notebook vs Script Tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1611156#M74116</link>
    <description>&lt;P&gt;Thanks!&amp;nbsp; I'm off work until Tuesday but will let you know.&lt;/P&gt;</description>
    <pubDate>Fri, 02 May 2025 15:49:47 GMT</pubDate>
    <dc:creator>DanCrawford</dc:creator>
    <dc:date>2025-05-02T15:49:47Z</dc:date>
    <item>
      <title>Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1610992#M74113</link>
      <description>&lt;P&gt;Hello.&amp;nbsp; I find that when I run a python command from my project notebook, the script runs and does what I expect it to.&amp;nbsp; When I run the same code from a toolbox script that I just created, it runs without error but doesn't do anything.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;This is the notebook command:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;arcpy.cartography.ConvertLabelsToGraphics(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp; 'Map', 20000, 'SINGLE_LAYER', 'XBA/New LTC-SUP/PofC', 'Graphics', 'DISPLAY',&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;'GRAPHICS_LAYER_PER_FEATURE_LAYER', 'ONLY_PLACED', 'GroupGraphics')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;This is the tool script:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;import arcpy&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;def pofctographic():&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;tenure_type=arcpy.GetParameterAsText(0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;if tenure_type == "LTC-SUP":&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("LTC-SUP selected")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp;&amp;nbsp; arcpy.cartography.ConvertLabelsToGraphics(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Map', 20000, 'SINGLE_LAYER', 'XBA/New LTC-SUP/PofC', 'Graphics', 'DISPLAY', &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; 'GRAPHICS_LAYER_PER_FEATURE_LAYER', 'ONLY_PLACED', 'GroupGraphics')&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;if tenure_type == "CP":&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp; arcpy.AddMessage("CP selected")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp; arcpy.cartography.ConvertLabelsToGraphics(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Map', 20000, 'SINGLE_LAYER', 'XBA/New CP/PofC', 'Graphics', 'DISPLAY', &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'GRAPHICS_LAYER_PER_FEATURE_LAYER', 'ONLY_PLACED', 'GroupGraphics')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#339966"&gt;pofctographic()&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2025 23:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1610992#M74113</guid>
      <dc:creator>DanCrawford</dc:creator>
      <dc:date>2025-05-01T23:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1611038#M74115</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/297712"&gt;@DanCrawford&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think in the Notebook, it's setting all the project parameters automatically, but in the Toolbox, you may need to explicitly specify where everything's going, something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

def pofctographic():
    aprx = arcpy.mp.ArcGISProject("CURRENT")  # If in Pro, "CURRENT" if a .aprx file, use the path to that file
    map_obj = aprx.listMaps("Map")[0]  # Make sure 'Map' matches the name of your map

    tenure_type = arcpy.GetParameterAsText(0)
    if tenure_type == "LTC-SUP":
        arcpy.AddMessage("LTC-SUP selected")
        arcpy.cartography.ConvertLabelsToGraphics(
            map_obj, 20000, 'SINGLE_LAYER', 'XBA/New LTC-SUP/PofC', 'Graphics', 'DISPLAY',
            'GRAPHICS_LAYER_PER_FEATURE_LAYER', 'ONLY_PLACED', 'GroupGraphics')
    elif tenure_type == "CP":
        arcpy.AddMessage("CP selected")
        arcpy.cartography.ConvertLabelsToGraphics(
            map_obj, 20000, 'SINGLE_LAYER', 'XBA/New CP/PofC', 'Graphics', 'DISPLAY',
            'GRAPHICS_LAYER_PER_FEATURE_LAYER', 'ONLY_PLACED', 'GroupGraphics')

pofctographic()&lt;/LI-CODE&gt;&lt;P&gt;Let me know if that works!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 11:02:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1611038#M74115</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-05-02T11:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1611156#M74116</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; I'm off work until Tuesday but will let you know.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2025 15:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1611156#M74116</guid>
      <dc:creator>DanCrawford</dc:creator>
      <dc:date>2025-05-02T15:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612096#M74133</link>
      <description>&lt;P&gt;Sadly, adding those parameters has no effect.&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 18:33:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612096#M74133</guid>
      <dc:creator>DanCrawford</dc:creator>
      <dc:date>2025-05-06T18:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612255#M74138</link>
      <description>&lt;P&gt;Same thing happens if I run it as a model.&amp;nbsp; Manual model works fine, run from the toolbox does nothing.&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 23:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612255#M74138</guid>
      <dc:creator>DanCrawford</dc:creator>
      <dc:date>2025-05-06T23:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612399#M74140</link>
      <description>&lt;P&gt;I don't have much constructive to add except for I'm currently wrapping up a support case where notebooks/python window work for the code but an ATBX or a PYT also run and do nothing with the exact same code while calling a Geoprocessing Service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;All this to say, it isn't unheard of.&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 13:29:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612399#M74140</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-05-07T13:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612881#M74149</link>
      <description>&lt;P&gt;I swapped out the toolbox parameter for a feature layer input and got it down to this 2-line reproduction:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arcpy.cartography.ConvertLabelsToGraphics(
    arcpy.mp.ArcGISProject("CURRENT").activeMap,
    20000,
    'SINGLE_LAYER',
    arcpy.GetParameterAsText(0),
    'Graphics',
    'MAXOF',
    'GRAPHICS_LAYER_PER_FEATURE_LAYER',
    'ONLY_PLACED',
    'GroupGraphics'
)&lt;/LI-CODE&gt;&lt;P&gt;I get the same issue as you in Pro 3.4.0, no changes are made to the map. I think the next move is to contact your support team to see if they can replicate it, hopefully this leads to a bug fix or a workaround.&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 16:09:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612881#M74149</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-05-08T16:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612890#M74150</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; I have opened a ticket with ESRI.&amp;nbsp; I'll update this post if/when a solution is provided.&lt;/P&gt;</description>
      <pubDate>Thu, 08 May 2025 16:22:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1612890#M74150</guid>
      <dc:creator>DanCrawford</dc:creator>
      <dc:date>2025-05-08T16:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Difference: Project Notebook vs Script Tool</title>
      <link>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1613509#M74169</link>
      <description>&lt;P&gt;Dylan from ESRI Canada has provided this solution:&lt;BR /&gt;&lt;SPAN&gt;As a workaround, you can assign the result of the arcpy.cartography.ConvertLabelsToGraphics function to a variable, then add the first element of this variable (which will be the group layer) to the map object as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
arpx = arcpy.mp.ArcGISProject("CURRENT")
map_obj = arpx.listMaps("Map")[0]
glayer = arcpy.cartography.ConvertLabelsToGraphics(map_obj, 2000, 'SINGLE_LAYER', 'XBA/PofC')
map_obj.addLayer(glayer[0])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Thank-you Dylan!&lt;/P&gt;</description>
      <pubDate>Sun, 11 May 2025 04:59:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/difference-project-notebook-vs-script-tool/m-p/1613509#M74169</guid>
      <dc:creator>DanCrawford</dc:creator>
      <dc:date>2025-05-11T04:59:07Z</dc:date>
    </item>
  </channel>
</rss>

