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)

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 23, 2016 at 9:44
1
  • 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? Commented Jun 23, 2016 at 9:48

1 Answer 1

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")
answered Jun 23, 2016 at 10:40
4
  • 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' Commented Jun 23, 2016 at 10:42
  • hi i just edited the script and run it and i had the message above. Commented Jun 23, 2016 at 10:43
  • 3
    It's CreateFeatureclass_management() you should use, CreateFeatures_management() doesn't exist. Commented 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. Commented Jun 23, 2016 at 11:03

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.