We’re rewarding the question askers & reputations are being recalculated! Read more.
7

Using the API wrong. arcpy.da's second argument is a list of fields, not a where clause. Did you mean: cursor = arcpy.da.UpdateCursor(featureClass, ['*'], "{0} = '{1}'".format("PropCode", hotelDict["hotelId"]))


7

You have misunderstood how the updateRow method works. It is a method of the cursor as a whole and takes a row object as its argument: fromUpdateCursor_4Depth.updateRow(updateFromRow) You have to assign all of your update variables to the row object to write them to that row. I am not sure how your update fields match up with the variables, but they ...


7

Never, never, never use embedded cursor loops. Never! It is bad for performance, memory, data safety, etc. It is very, very bad. See my blog on Turbo Charging Data Manipulation with Python Cursors and Dictionaries. Load the look up table into a dictionary with a data access search cursor, then update the other table with an update cursor by matching it ...


6

Firstly you are looping through all the characters in carpeta not all the rasters; i.e. carpeta = arcpy.env.workspace = r"C:\Base_de_datos\Cuencas_raster" for raster in carpeta: print raster C : \ B a etc... You need to use ListRasters (or arcpy.da.walk). Secondly, you need to pass a list or tuple of field names. You are passing a single string ...


6

You have a typo in your workspace env.workspace= "C:/Esripress/Python/Data/Excercise08" - possibly should be Exercise08 This typo will cause the error you are encountering. Fixing the typo should make the code run as expected. I get the same error when I run your code with a typo in the workspace path. Only thing I've changed in your code, to get it to ...


6

I suspect your error is that: env.workplace = "E:/" should be: env.workspace = "E:/"


5

mapping.py is running an assertion test to make sure that your report source is a MapDocument, TableView, or Layer. This is the first argument you provided. And it is not a MapDocument, TableView, or Layer, it is a string. That is what AssertionError: <type 'str'> means. Instead of giving the string '2013pp' you need a reference directly to 2013pp as ...


5

Python is case sensitive, you have a lower case "p" in both the points and polygon variable names, but reference those two variables in your code with a capital "P". The code fails b/c it is trying to reference variables that do not exist within the cursor and join statements. With you update an additional error msg I see couple more issues: The first two ...


4

One or both of your fields in srvMatFld and serviceID don't exist. Could be a typo in your parameter(s). Here is my test script based on your code (I've just added a few extra print statements to make things stand out: import arcpy print "######################################################" xx = r"d:\gis\se\gisse.gdb\testpoint" srvMatFld = 'intfield' ...


4

The required input for field names on a cursor is a list of fields and your function resetFieldList is returning a string, not a list. Try something like this: def resetFieldList(InitialFieldList): FieldList = InitialFieldList.split(";") # split method returns a list return FieldList


4

The error RuntimeError: A column was specified that does not exist. usually comes from the cursor when you supply in the list of input fields a field that does not exist. There are some things you can do for troubleshooting: Try printing all the fields in the feature class before using da.UpdateCursor using arcpy.ListFields(): Code: for f in fdList: ...


3

You're using a cursor object as in input for your arcpy tool, which isn't valid. I'd suggest trying something else. One method is to create a line feature class in the same spatial reference as your points. Then iterate through your points, iterate again in a nested loop, and create line geometries from your two XY's. Insert these geometries into your newly ...


2

Juggling single quotes and double quotes can be a pain, but this should work: with arcpy.da.SearchCursor(Wells_Intersect_Layer, "COUNTY", '"COUNTY" = \'{}\''.format(cname)) as cursor: for row in cursor: Although you could probably also get around it by specifying the Where clause separately: # Count Wells in each County #for cname in countyList: ...


2

The problem may be in your where_clause. '"COUNTY "= ' + cname You have a space between the attribute name and quotation mark instead of quotation mark and equal sign, which I think will throw it off. Try instead: "COUNTY = '{}'".format(cname) "COUNTY = '" + cname + "'" # this is the same, but I find it harder to read! You need those quotation marks ...


2

I think the problem here is that you are treating the SearchCursor() like a geo-processing tool. Geo-processing tools can honour 1 or more environment settings (which you find out by looking at the help for the tool) and one such setting is workspace. Nowhere on the help page for SearchCursor() does it state that Workspace is an environment setting that it ...


2

I think this might be a path issue, try example below. e.g. arcpy.mapping.ExportReport('2013pp',r"C:\reports\2013_Graffiti.rlf",r"C:\reports\2013_Graffiti_report.pdf")


2

Check your RDNew string. The extra double quotes around the # may be throwing things off. If they're meant to be in the string escape them with a backslash. If looks like the variable has the extra ,"#","#","DECIMAL_POINT" in it from the parameters in your arcpy.ASCII3DToFeatureClass_3d call.


2

You are jumping the gun on the usage of SearchCursor. files is simply a list of strings of file paths. arcpy.da.SearchCursor expects a string for the in_table argument but in the schema of either a '...feature class, layer, table, or table view.' Instead of a string of a feature class, layer, table, or table view, you are passing a realtive, system, ...


2

Yes, there is a problem with spaces in layer's path when running Integrate (and some other tools). To avoid this try to set the environment variable env.workspace to layer's base directory (or database). Then run the tool using only the name of your feature class without full path.


2

It looks like you're getting the parameter from the user, then defining them further in a hard-coded script. You could put all the parameters in the user's hands: import arcpy from arcpy import env env.workspace = arcpy.GetParameterAsText(0) gdb = arcpy.GetParameterAsText(1) in_features = arcpy.GetParameterAsText(2) integrate_features = arcpy....


2

Try replacing: arcpy.env.workspace = "H:\GIS Project\Bulk Density\In Rasters" with: arcpy.env.workspace = r"H:\GIS Project\Bulk Density\In Rasters" or: arcpy.env.workspace = "H:\\GIS Project\\Bulk Density\\In Rasters" or: arcpy.env.workspace = "H:/GIS Project/Bulk Density/In Rasters" The backslash is a special character to Python and so strings for ...


2

You have written twice the name of the geodatabase. Try removing one. \\PLDV3_SPC_ODN_315_25Sep.gdb\\PLDV3_SPC_ODN_315_25Sep.gdb pld3GDB = 'C:\\Users\\bro81520\\Documents\\ArcGIS\\PLDV3_SPC_ODN_315_25Sep.gdb\\WO_HIERARCHY'


1

The sql_clause parameter for the da.UpdateCursor is a tuple. From the help page: An optional pair of SQL prefix and postfix clauses organized in a list or tuple. SQL prefix supports None, DISTINCT, and TOP. SQL postfix supports None, ORDER BY, and GROUP BY. An SQL prefix clause is positioned in the first position and will be inserted between ...


1

So I realized it was drawing the first polyline but then crashing on the subsequent ones. I determined the problem was with trying to clear the contents of the array. array = [] The object is actually an arcpy array and not just a python array, so you can't do an assignment like that which is what caused the error. I needed to use the removeAll() method ...


1

I thought your issue is related to Sweeping == 0 after your second else which should be Sweeping = 0 to turn the switch off but think your method to empty the array is faulty. You should use removeAll() method of array instead of array = []. Also you need to make sure the length of the array should be at least two to be able to draw a line. Additionally, ...


1

You can check the following things: Look at where the AddError is happening, if at all. Check the memory usage isn't hitting too much RAM. I have noticed problems around 1.5+ GB. Check to see if the traceback has been disabled, or anything really discussed in this thread: https://stackoverflow.com/questions/17784849/in-python-how-do-i-print-an-error-message-...


1

I suggest using a GP tool Domain To Table passing in a specific domain gFittingType. You can use an in-memory table to avoid writing to the disk. temp_table = r"in_memory\data" arcpy.DomainToTable_management(in_workspace=r"C:\GIS\my.gdb", domain_name="gFittingType", out_table=temp_table, ...


1

I am able to reproduce your issue on ArcGIS 10.4.1. This issue can be reproduced using any other field, so it's not OBJECTID specific. My guess is that because you hide a field when creating a table view, it might get misinterpreted by the Table To Excel tool and it gets an empty string internally. There are a couple of workarounds: Using external ...


1

UPDATED. This works. The real issue this script could not be run twice in a row on the same feature class appears to have something to do with being locked by the layer in the current MXD after the 1st run. So I made the script to change the data path on that layer when running, then change it back at the end of the script. arcpy.env.overwriteOutput = ...


1

If you are trying to set the extent using a layer in your MXD you do not need to specify the path of the underlying feature class. arcpy.env.extent can be set to the actual layer. >>> print arcpy.env.extent None >>> arcpy.env.extent = "testPoint" >>> print arcpy.env.extent 1880391.189 5821879.3835 1885687.1515 5825657.3949 NaN ...


Only top voted, non community-wiki answers of a minimum length are eligible