I am using python, arctoolbox and arcpy 10.0

I am running a script that is tied to an arctoolbox. The toolbox serves to enter in my parameters. I have a feature layer as an input. The feature layer has the .dbf, .prj. shp, etc files.

I am trying to create an output shapefile. The output toolbox parameter is a shapefile. It generates a .shp, .xml, .dbf, but NOT a .prj file

I tried the following code to get the .prj file from my input file to also be included in the output file.

# Toolbox Parameters
# Gets input file
_in_polyline_m_layer = arcpy.GetParameterAsText(0)
_ResultFile = arcpy.GetParameterAsText(6)

spatial_reference = arcpy.Describe(_in_polyline_m_layer).spatialReference
# Creating my output file
arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', spatial_reference)

I keep getting this error: Error 000623: Invalid value type for parameter template. Not sure if the problem is within my script or in the actual toolbox. Any ideas or suggestions would be greatly appreciated. THanks in advance

  • 1
    As a suggestion you could print out the contents of your spatial_reference variable, and compare it to what Copy As Python Snippet (from Geoprocessing | Results) gives when you do your Create Feature Class manually.
    – PolyGeo
    Mar 21, 2013 at 22:57

3 Answers 3


You might want to try converting your spatial reference object to a string. Try adding the exportToString() method like so:

spatial_reference = arcpy.Describe(_in_polyline_m_layer).spatialReference.exportToString()

If you get an error, you may need to write exporttostring() in lower case rather than camel case (despite what's shown in the ArcGIS online help).

Hope that helps.


I have found the problem. The line of code to create a shapefile:

arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', spatial_reference)

also takes optional parameters. My spatial_reference parameter was in the wrong order. I was missing some parameters. The correct line of code should be:

arcpy.CreateFeatureclass_management(out_path, out_name, 'POLYGON', "","","",spatial_reference)

By adjusting the code in my previous post above to include the changed line of code, upon creating my shapefile, the porjection file is created as well.


I'm not sure about doing this in Arc, but in python I would use gdal_info to retrieve projection information and just copy this to a file with the .prj extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.