|
DOC
|
A potential use might be to decide which tool to use on the fly (maybe while iterating through a geodatabase with arcpy.da.walk) depending on if you're looking at a table or a feature class. Like make a feature layer or a table view. Still don't know what particular use case would require that. I'm sure someone's needed this though!
... View more
02-19-2015
01:28 PM
|
0
|
0
|
3045
|
|
DOC
|
That is pretty nifty. It took me a moment to realize it's dynamic in that the code can dynamically choose the tool to run (based on some logic) rather than getting dynamic input from the user. And when you say unpack the arguments, you're referring to the items in the list. If your tool only has one argument, I found you can pass it just bare (without the list) if you get rid of the asterisk. But that is just me experimenting, your way is recommended since it will accommodate all cases. Thanks for the post!
... View more
02-19-2015
01:10 PM
|
0
|
0
|
3045
|
|
POST
|
It doesn't sound like you are doing any edits (step 2.3 and 2.4), but are you starting an edit session in there anywhere? ArcGIS Help 10.2 - Editor (arcpy.da) If yes, are you explicityly stopping the edit session? If no, why do you need to create a version for read-only operations? EDIT: Just to verify your code works, try a simplified version of your script that just creates the version and then deletes it. Then scale it up to create the version, switch to it, switch back to Default, then delete the version. The success or failure of these actions might help troubleshoot the problem.
... View more
02-19-2015
12:47 PM
|
0
|
9
|
4273
|
|
POST
|
I'm just guessing here, but try running the Clear Workspace Cache Data Management tool before you delete the version. ArcGIS Help 10.2 - Clear Workspace Cache (Data Management)
... View more
02-19-2015
12:27 PM
|
1
|
1
|
4273
|
|
POST
|
I'm on ArcGIS 10.2.2 and trying to use arcpy.da.Editor and an InserCursor on a versioned feature class. The feature class was registered without the option to move edits to base and resides in a 10.0 SDE on Oracle 11g (will be 10.2.2 SDE soon). I found this helpful post by Leslie Morgan that really details my same situation, but there are no code samples. I would like to know if any of you have used the Python Editor in a similar setup and what your code looks like. More specifically, can the Editor class be used in a with statement like the Esri help article says or do I still have to start and stop the operation and edit session like users say?
... View more
02-17-2015
04:32 PM
|
0
|
8
|
32295
|
|
POST
|
Just for funzies, if you are using a simple counter like you do at the end with ctr, you can also use += 1 to make the code a little simpler. Just know that += might not always be what you want. ctr += 1
... View more
02-17-2015
10:39 AM
|
0
|
0
|
10912
|
|
POST
|
I'll just leave this here while someone in the community works on posting an answer to your question Posting Code blocks in the new GeoNet
... View more
02-13-2015
11:59 AM
|
0
|
1
|
2989
|
|
POST
|
I haven't made an add-in yet, but it seems like you're trying to make your easy button too easy! Just train your users how to add the required tools to the toolbar. At some point you reach diminishing returns trying to code for so many exceptions. Just an observation, I could be way off.
... View more
02-13-2015
11:55 AM
|
0
|
0
|
833
|
|
POST
|
Cool trick about using the global list. I didn't know you could do that in a field calc!
... View more
02-12-2015
03:42 PM
|
0
|
1
|
11244
|
|
POST
|
I have a similar situation. I just tested using truncate and append on a file geodatabase with locks. If it was just a geodatabase lock (like some had it open in ArcCatalog) the truncate/append worked. However, if someone had the feature class being truncated open in ArcCatalog preview, the truncate worked but the append failed with ERROR 000224: Cannot insert features Failed to execute (Append). I tested this on 10.2.2 using Pyhon. EDIT: If the feature class is opened in ArcCatalog with geometry preview, truncate/append works. If it's open with table preview, truncate works but append fails. Same thing happens with ArcMap; if the feature class is open in data view it will truncate/append but if the attribute table is also open it will truncate but fail to append.
... View more
02-12-2015
10:43 AM
|
0
|
0
|
1514
|
|
POST
|
Does this thread have the answer you're looking for? ModelBuilder - Creating a Variable Picklist
... View more
02-12-2015
09:28 AM
|
0
|
0
|
2178
|
|
POST
|
Ah, yes, I follow now. However, I think you have to put an extra comma after the variable inside the parenthesis to make it a true tuple. fld_name = "Particle"
print fld_name
print (fld_name)
print (fld_name,) produces: Particle
Particle
('Particle',)
... View more
02-11-2015
03:38 PM
|
0
|
0
|
1475
|
|
POST
|
But the Esri documentation for the Update cursor says: For a single field, you can use a string instead of a list of strings. I'm not trying to be a nit-pick know-it-all, I'm just trying to understand.
... View more
02-11-2015
03:04 PM
|
0
|
1
|
1475
|
|
POST
|
In the line where you open the update cursor, why do you have extra parenthesis around fld_name? with arcpy.da.UpdateCursor(fc, (fld_name)) as curs:
... View more
02-11-2015
02:42 PM
|
0
|
5
|
1475
|
|
POST
|
Great point Richard. I did a little research and I found the reserved keywords in Python 2.7 Although TABLE is not a Python reserved keyword, it is in SQL and so it should be avoided.
... View more
02-11-2015
02:17 PM
|
0
|
0
|
1922
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM | |
| 1 | 12-01-2025 06:19 AM |