<?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: Python scripting and creating random points in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199257#M6841</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For me, the problem persists with ArcGIS Desktop Service Pack 2 (build 3200).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When running "outside" of ArcMap, it works fine.&amp;nbsp; When running from a toolbox, ArcGIS crashes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Sep 2011 06:30:09 GMT</pubDate>
    <dc:creator>HåvardTveite</dc:creator>
    <dc:date>2011-09-02T06:30:09Z</dc:date>
    <item>
      <title>Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199252#M6836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have created a model in model builder that takes a data set and then completes a select by attributes, buffer, and create random points geoprocesses (in that order).&amp;nbsp; This works.&amp;nbsp; When I export the model to a python script and run, Arc crashes when it gets to the create random points step.&amp;nbsp; Has anyone else had this issue?&amp;nbsp; Is there a work around?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# ---------------------------------------------------------------------------
# Location_Error_Arc10.py
# Created on: 2010-09-10 17:26:43.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Usage: Location_Error_Arc10 &amp;lt;Distance__value_or_field_&amp;gt; &amp;lt;Dg_ysf&amp;gt; 
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

arcpy.env.overwriteOutput = True

# Script arguments
Distance__value_or_field_ = arcpy.GetParameterAsText(0)
Dg_ysf = arcpy.GetParameterAsText(1)

# Local variables:
Output_Location = "C:\\Alamo_Project\\Alamo_Breccia.mdb\\Measured_Sections\\"
Temp_Ysf = "C:\\Alamo_Project\\Alamo_Breccia.mdb\\Measured_Sections\\Temp_Ysf"
Dg_ysf_Buffer = "C:\\Alamo_Project\\Alamo_Breccia.mdb\\Measured_Sections\\Dg_ysf_Buffer"
Dg_ysf_Random__2_ = "C:\\Alamo_Project\\Alamo_Breccia.mdb\\Measured_Sections\\Dg_ysf_Random"
Dg_ysf_Random__3_ = "C:\\Alamo_Project\\Alamo_Breccia.mdb\\Measured_Sections\\Dg_ysf_Random"

# Process: Select Layer By Attribute (6)
arcpy.SelectLayerByAttribute_management(Dg_ysf, "NEW_SELECTION", "[Min_Thick] = '2'")

# Process: Copy Features
arcpy.CopyFeatures_management(Dg_ysf, Temp_Ysf, "", "0", "0", "0")

# Process: Buffer
arcpy.Buffer_analysis(Temp_Ysf, Dg_ysf_Buffer, Distance__value_or_field_, "FULL", "ROUND", "NONE", "")

# Process: Create Random Points
arcpy.CreateRandomPoints_management(Output_Location, "Dg_ysf_Random", Dg_ysf_Buffer, "0 0 250 250", "1", "0 Meters", "POINT", "0")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Sep 2010 23:24:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199252#M6836</guid>
      <dc:creator>JosephSheffield</dc:creator>
      <dc:date>2010-09-10T23:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199253#M6837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;from the arcmap 10 help files, the example shows that the number of points and the minimum distance are numbers, in your example you are passing strings, alternately try assigning a variable the values and pass that to the method.&amp;nbsp; See this link for other examples&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000002r000000.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000002r000000.htm&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;ie.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;outName = "randomMPs"
fcExtent = "C:/data/county.gdb/county"
numPoints = 100
numMP = 10
arcpy.CreateRandomPoints_management(outGDB, outName, "", fcExtent, numPoints, "", "MULTIPOINT", numMP)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:56:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199253#M6837</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T09:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199254#M6838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;CreateRandomPoints appears to be bugged when called from a toolbox (i.e. importing a python script to a Toolbox). The function runs properly when called directly from the script, but it will completely crash Arc (SOC if published, Catalog/Map if local) when called as a tool. It works in modelbuilder, but not in python. I've tested about every permutation of variables and they all crash. What gives?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
numPoints="2000"
minDist="1000 Meters"
in_memory="in_memory"
arcpy.CreateRandomPoints_management(in_memory, "testfile", "", "", numPoints, minDist,"POINT","0")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried changing numPoints to an int, the output location, the output name, the constraining FC and/or extent, all to no avail. This is pretty frustrating, as these unhandled errors crashing Arc are really poor reflections of the engine. Any insight would be extremely appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:56:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199254#M6838</guid>
      <dc:creator>AaronHigh</dc:creator>
      <dc:date>2021-12-11T09:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199255#M6839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am experiencing the same problem. Python script works fine when called from Pythonwin but fails when added as a script in the arc toolbox. Has there been any resolutions or workarounds?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 11:25:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199255#M6839</guid>
      <dc:creator>DeborahDeats</dc:creator>
      <dc:date>2011-06-15T11:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199256#M6840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Deborah,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a known problem that esri has acknowledged. Create random points in a python script added as a tool in a toolbox will not work and will crash the application every time. However, if you install Service Pack 2 for ArcGIS Desktop, the problem has been resolved.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2011 13:52:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199256#M6840</guid>
      <dc:creator>AaronBarkhurst</dc:creator>
      <dc:date>2011-06-15T13:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199257#M6841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For me, the problem persists with ArcGIS Desktop Service Pack 2 (build 3200).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When running "outside" of ArcMap, it works fine.&amp;nbsp; When running from a toolbox, ArcGIS crashes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 06:30:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199257#M6841</guid>
      <dc:creator>HåvardTveite</dc:creator>
      <dc:date>2011-09-02T06:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Python scripting and creating random points</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199258#M6842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes - in my experience this tool is buggy when used in a stand-alone python script.&amp;nbsp; I've had inconsistent results (in an iterative model, used for parameter estimation by monte carlo method) with this tool.&amp;nbsp; I've found that replacing the variable containing the string for the actual string improves reliablity, as does reading/writing from drive as opposed to the in-memory workspace.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The 'explicit variable' workaround is a pain; I have to remember to adjust this path on line 1xx rather than just at the top, in the variable declaration block.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2011 21:45:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/python-scripting-and-creating-random-points/m-p/199258#M6842</guid>
      <dc:creator>DarylVan_Dyke</dc:creator>
      <dc:date>2011-09-12T21:45:11Z</dc:date>
    </item>
  </channel>
</rss>

