Skip to main content
34 events
when toggle format what by license comment
Apr 27, 2017 at 10:11 history edited PolyGeo
edited tags
Oct 11, 2015 at 8:33 history closed PolyGeo Duplicate of Adding shapefile or feature class as layer in ArcMap using ArcPy
Feb 3, 2015 at 8:12 answer added gisuser timeline score: 0
Jan 25, 2015 at 1:53 answer added user681 timeline score: 0
Jan 25, 2015 at 0:01 history edited gisuser CC BY-SA 3.0
added 435 characters in body
Jan 24, 2015 at 21:57 answer added MrBubbles timeline score: 1
Jan 24, 2015 at 19:56 history edited gisuser CC BY-SA 3.0
deleted 18 characters in body
Jan 24, 2015 at 0:15 history reopened PolyGeo
Jan 24, 2015 at 0:15 comment added PolyGeo I'll re-open this question to see if anyone will post an Answer. I'll try to get back and test it - for some reason I thought you were using 10.0 but it seems to be 10.2 so I must have misread.
Jan 24, 2015 at 0:01 history edited gisuser
edited tags
Jan 23, 2015 at 23:55 comment added gisuser Noted, agreed, and I just tried your suggestion - same procedure (with the new path of course), same error. As to the OS: Windows Server 2012 Standard, and I also tested this code on a linux installation (don't know what the exact installation was) and received the same error.
Jan 23, 2015 at 23:54 review Reopen votes
Jan 24, 2015 at 0:21
Jan 23, 2015 at 23:49 comment added PolyGeo Placing a shapefile in "C:/Python27/ArcGISx6410.2" seems like a very risky thing to do - try copying it to a simple location like C:\temp as a test. Also, what is your precise operating system? It sounds like you may need to double-check your configuration against the System Requirements for 10.0.
Jan 23, 2015 at 23:48 comment added gisuser My code snippet is currently displaying for me as having set arcpy.env.workspace - perhaps reload the page or something?
Jan 23, 2015 at 23:46 comment added PolyGeo Your current code snippet does not include setting your workspace via arcpy.env.workspace prior to trying to use a shapefile from it without the full path being specified. Unfortunately, I do not have 10.0 to test your code.
Jan 23, 2015 at 23:46 history edited gisuser CC BY-SA 3.0
deleted 21 characters in body
Jan 23, 2015 at 23:41 comment added gisuser @PolyGeo I copied out more of the code for you, hope it helps?
Jan 23, 2015 at 23:41 history edited gisuser CC BY-SA 3.0
deleted 21 characters in body
Jan 23, 2015 at 23:36 comment added gisuser Have tried that as well mr.adam
Jan 23, 2015 at 23:35 history edited gisuser CC BY-SA 3.0
deleted 21 characters in body
Jan 23, 2015 at 23:35 comment added mr.adam may be worth setting your workspace to the folder that contains the shapefile: arcpy.env.workspace = r"Z:\program..." and then you just put "shapefile.shp" as the first parameter?
Jan 23, 2015 at 23:33 comment added PolyGeo What precise code did you run? What precisely was the error you received from that code? In your question I can only see you trying the other way.
Jan 23, 2015 at 23:32 comment added gm70560 put: putputarcpy.env.workspace = "in_memory" on the line after: import arcpy
Jan 23, 2015 at 23:32 comment added gisuser I found that link several hours ago, and tried it to no avail. This line: newlayer = arcpy.mapping.Layer(path_to_shapefile_or_feature_class) gives an error.
Jan 23, 2015 at 23:31 comment added PolyGeo This answer from the duplicate has the technique that I think should work at 10.0 - gis.stackexchange.com/a/12538. I think the one you are trying had a bug that was fixed at 10.1 SP1.
Jan 23, 2015 at 23:30 history closed PolyGeo Duplicate of Adding shapefile or feature class as layer in ArcMap using ArcPy
Jan 23, 2015 at 23:29 comment added gisuser arcpy.Exists(myfile) returns True
Jan 23, 2015 at 23:27 history edited gisuser CC BY-SA 3.0
added 12 characters in body
Jan 23, 2015 at 23:26 comment added gisuser Apologies, error in the question. I am passing two parameters, I'll update that now.
Jan 23, 2015 at 23:25 comment added phloem MakeFeatureLayer has 2 required parameters. You need an output layer, like: arcpy.MakeFeatureLayer_management("C:/blah/blah.shp", "myNewLayer")
Jan 23, 2015 at 23:25 comment added gisuser I have tried. Trust me, I have tried every combination of escapes, slashes, and string literals for the filepath. I get the same error no matter which. I used the os module to confirm the file's existence, but haven't tried arcpy.Exists. I'll do that now.
Jan 23, 2015 at 23:13 review First posts
Jan 23, 2015 at 23:31
Jan 23, 2015 at 23:08 comment added gm70560 What does arcpy.Exists(yourFile) return? Your path has forward slashes. Try "Z:\\program\\..\\shapefile.shp".
Jan 23, 2015 at 23:04 history asked gisuser CC BY-SA 3.0