Been stuck on this for a while this afternoon.
I have been writing a script tool which loads some data from a table in a db.
I needed to then set the spatial reference of the coordinates.
So, in my script I had :
SR = arcpy.GetParameterAsText(1)
And in the tool properties, this is set to a Coordinate System data type. So you get the nice pull down list of the available coordinate systems.
However, this returns a text representation of the prj, not a spatial reference object.
Then I tried to do this :
SR = arcpy.SpatialReference(arcpy.GetParameterAsText(1))
But you get an error because SR objects can only be created using :
1. Get them from a describe object
2. The WKID of the SR
3. A path to a projection file.
You cannot use a text string.
The answer turned out to be :
SRtxt = arcpy.GetParameterAsText(1)
SR = arcpy.SpatialReference() # an empty spatial reference object
Now on with the rest of it....