-1

I'm having trouble with a toolbox based on a python script that converts the projection of shapefiles. I want to choose a folder that contains my shp, convert them to wgs84 then put them in another folder:

# -*- coding: utf-8 -*-

# Import arcpy module
import arcpy, sys
import os
from arcpy import env

# Script arguments
Folder_input = arcpy.GetParameterAsText(0)
folder_output=arcpy.GetParameterAsText(1)
Output_Coordinate_System = arcpy.GetParameterAsText(2)

# Process: Project
arcpy.env.workspace= Folder_input
arcpy.env.overwriteOutput = True
for infc in acrpy.ListFeatureClasses():
     Output_Dataset_or_Feature_Class=os.path.join(folder_output, infc)
     arcpy.Project_management(infc, Output_Dataset_or_Feature_Class,Output_Coordinate_System, "", "")
     arcpy.env.scratchWorkspace = tempEnvironment0

I have this error

ERROR : NameError: name 'acrpy' is not defined

Failed to execute (Script).

  • Seriously? "Acrpy"?? – whuber Jul 16 '16 at 19:18
4

You have a typo:

for infc in acrpy.ListFeatureClasses():

acrpy should be arcpy

Correcting the typo should eliminate that error.

  • Thank you, I corrected the error but my script failed when my folder contains more than one shape file, it convert the projection of one shp then gives this message : Not defined – Hchliyah Jul 18 '16 at 8:17
  • @Hchliyah is that the entire error? If it's different to the previous acrpy error it might be worth asking a separate question – Midavalo Jul 18 '16 at 8:27
  • Yes it's the entire error – Hchliyah Jul 18 '16 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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