<?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: Help with standalone script from model builder model in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005954#M59179</link>
    <description>&lt;LI-CODE lang="python"&gt;import arcpy

oms_span = r"D:\pathtoyour.gdb\Blink Outages\oms_span"
test_kmz = r"F:\test\Project\test.kmz"

arcpy.MakeFeatureLayer_management(oms_span, "oms_span_lyr")

arcpy.SelectLayerByAttribute_management("oms_span_lyr", "NEW_SELECTION", "gs_outg_cd = 31 OR gs_outg_cd = 32 OR gs_outg_cd = 35")

arcpy.LayerToKML_conversion("oms_span_lyr", test_kmz, "0", "NO_COMPOSITE", "DEFAULT", "1024", "96", "CLAMPED_TO_GROUND")&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 01 Dec 2020 19:23:07 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-12-01T19:23:07Z</dc:date>
    <item>
      <title>Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005901#M59176</link>
      <description>&lt;P&gt;I have a simple model that I've built in model builder and I would like to be able to run in it as a standalone script. I think the issue is that the script doesn't know where to find the layer from the mxd file, but I don't know the syntax to tell it where to find it. Can someone take a look and help please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Local variables:&lt;BR /&gt;oms_span = "Blink Outages\\oms_span"&lt;BR /&gt;oms_span__2_ = oms_span&lt;BR /&gt;test_kmz = "F:\\test\\Project\\test.kmz"&lt;/P&gt;&lt;P&gt;# Process: Select Layer By Attribute&lt;BR /&gt;arcpy.SelectLayerByAttribute_management(oms_span, "NEW_SELECTION", "gs_outg_cd = 31 OR gs_outg_cd = 32 OR gs_outg_cd = 35")&lt;/P&gt;&lt;P&gt;# Process: Layer To KML&lt;BR /&gt;arcpy.LayerToKML_conversion(oms_span__2_, test_kmz, "0", "NO_COMPOSITE", "DEFAULT", "1024", "96", "CLAMPED_TO_GROUND")&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 16:54:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005901#M59176</guid>
      <dc:creator>JoshBlack</dc:creator>
      <dc:date>2020-12-01T16:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005905#M59177</link>
      <description>&lt;P&gt;I'm assuming it's the path to the oms_span feature class that isn't working? Try changing&lt;/P&gt;&lt;LI-CODE lang="python"&gt;oms_span = "Blink Outages\\oms_span"&lt;/LI-CODE&gt;&lt;P&gt;to&lt;/P&gt;&lt;LI-CODE lang="python"&gt;oms_span = "your_geodatabase_path\\oms_span"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 17:08:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005905#M59177</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2020-12-01T17:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005908#M59178</link>
      <description>&lt;P&gt;When I change to the feature class path I get this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;The value cannot be a feature class&lt;BR /&gt;ERROR 000840: The value is not a Raster Layer.&lt;BR /&gt;ERROR 000840: The value is not a Mosaic Layer.&lt;BR /&gt;Failed to execute (SelectLayerByAttribute).&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 17:20:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005908#M59178</guid>
      <dc:creator>JoshBlack</dc:creator>
      <dc:date>2020-12-01T17:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005954#M59179</link>
      <description>&lt;LI-CODE lang="python"&gt;import arcpy

oms_span = r"D:\pathtoyour.gdb\Blink Outages\oms_span"
test_kmz = r"F:\test\Project\test.kmz"

arcpy.MakeFeatureLayer_management(oms_span, "oms_span_lyr")

arcpy.SelectLayerByAttribute_management("oms_span_lyr", "NEW_SELECTION", "gs_outg_cd = 31 OR gs_outg_cd = 32 OR gs_outg_cd = 35")

arcpy.LayerToKML_conversion("oms_span_lyr", test_kmz, "0", "NO_COMPOSITE", "DEFAULT", "1024", "96", "CLAMPED_TO_GROUND")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 01 Dec 2020 19:23:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1005954#M59179</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-01T19:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1006024#M59185</link>
      <description>&lt;P&gt;I think this will work. Thank you so much. The only problem now is that the output kmz already exists and I want to overwrite it each time i run the script. Is that possible?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 21:53:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1006024#M59185</guid>
      <dc:creator>JoshBlack</dc:creator>
      <dc:date>2020-12-01T21:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1006029#M59186</link>
      <description>&lt;P&gt;sure, just set an environment, best to put it under your import arcpy.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;enjoy.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 22:07:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1006029#M59186</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-12-01T22:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help with standalone script from model builder model</title>
      <link>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1006030#M59187</link>
      <description>&lt;P&gt;perfect. Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 22:10:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-standalone-script-from-model-builder/m-p/1006030#M59187</guid>
      <dc:creator>JoshBlack</dc:creator>
      <dc:date>2020-12-01T22:10:37Z</dc:date>
    </item>
  </channel>
</rss>

