0

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 Jun 23 '16 at 9:48
2

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 Jun 23 '16 at 10:42
  • hi i just edited the script and run it and i had the message above. – Young Engie Newton Jun 23 '16 at 10:43
  • 2
    It's CreateFeatureclass_management() you should use, CreateFeatures_management() doesn't exist. – GISGe Jun 23 '16 at 11:00
  • 1
    @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. – PolyGeo Jun 23 '16 at 11:03

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.