How to generate spatial weight matrix in python script?
<p>I need to create spatial weights matrices for different point shapefilesï¼so I tried to batch process in stand-alone Python script. Here is the example code exported from the ModelBuilder in the ArcGIS 10.2 software. </p>

<pre><code>import arcpy
test_shp = "D:\\My Documents\\ArcGIS\\test.shp"
tset_swm = "D:\\My Documents\\ArcGIS\\tset.swm"
arcpy.GenerateSpatialWeightsMatrix_stats(test_shp, "MyID", tset_swm,
                                     "K_NEAREST_NEIGHBORS", "EUCLIDEAN",
                                     "1", "", "4", "ROW_STANDARDIZATION",
                                     "", "", "", "")
</code></pre>

<p>The problem here is that there are no output files or messages. And interestingly, when I add </p>

<pre><code>print "hello world"
</code></pre>

<p>After the code execution, it should print a string "hello world" on the console, but there is no such output either!</p>

<p>Could anyone explain me what I'm doing wrong and how I can fix this?</p>

<p>I don't see anything wrong here. But isn't tset_swm in your code the output you are looking for? That is the output spatial weight matrix you generated based on your input shapefile. </p>

python arcgis arcpy