I want to create a number of featureclass using a template featureclass
import arcpy
from arcpy import env
env.workspace = "C:\new_docs\BIO-FILES\GIS_prog\Lesson1"
arcpy.CreateFeatures_management('C:\new_docs\BIO-FILES\GIS_prog\results","Precip2009Readings.shp","POINT","Precip2008Readings.shp","Disabled","Disabled")
When I run the above code I get:
Parsing error SyntaxError: EOL while scanning string literal (line 5)
-
Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. What happens when you run that code snippet?PolyGeo– PolyGeo ♦2016年06月23日 09:48:52 +00:00Commented Jun 23, 2016 at 9:48
1 Answer 1
You are getting that error because on line 5 you have opened a single quote without closing it.
Since you have used double rather than single quotes in the remainder of your code I suggest changing that single quote to a double quote.
Also, you need to let Python know that your pathnames should be interpreted as raw strings because the backslashes in a Python need to be escaped.
Try changing:
env.workspace = "C:\new_docs\BIO-FILES\GIS_prog\Lesson1"
arcpy.CreateFeatures_management('C:\new_docs\BIO-FILES\GIS_prog\results","Precip2009Readings.shp","POINT","Precip2008Readings.shp","Disabled","Disabled")
to
env.workspace = r"C:\new_docs\BIO-FILES\GIS_prog\Lesson1"
arcpy.CreateFeatureclass_management(r"C:\new_docs\BIO-FILES\GIS_prog\results","Precip2009Readings.shp","POINT","Precip2008Readings.shp","Disabled","Disabled")
-
Traceback (most recent call last): File "C:\Python27\ArcGIS10.3\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript exec codeObject in main.__dict__ File "C:\Users\buo_isa\Documents\lessons\stest.py", line 5, in <module> arcpy.CreateFeatures_management("C:\new_docs\BIO-FILES\GIS_prog\results","Precip2009Readings.shp","POINT","Precip2008Readings.shp","Disabled","Disabled") AttributeError: 'module' object has no attribute 'CreateFeatures_management'Young Engie Newton– Young Engie Newton2016年06月23日 10:42:40 +00:00Commented Jun 23, 2016 at 10:42
-
hi i just edited the script and run it and i had the message above.Young Engie Newton– Young Engie Newton2016年06月23日 10:43:22 +00:00Commented Jun 23, 2016 at 10:43
-
3It's
CreateFeatureclass_management()
you should use,CreateFeatures_management()
doesn't exist.GISGe– GISGe2016年06月23日 11:00:05 +00:00Commented Jun 23, 2016 at 11:00 -
2@YoungEngieNewton If you get new errors from the new code snippet that you are presenting then I think that should be done as a new question.2016年06月23日 11:03:44 +00:00Commented Jun 23, 2016 at 11:03