|
POST
|
@Chris -- because of that last, millions-of-records result. There's a certain amount of time required to set up/tear down a GP tool (which is what's causing the first two results in your benchmarks to look the way they do), but a for loop in a core GP tool looping over rows in its native ArcObjects/C++ implementation will be orders of magnitude faster than that of a for loop in Python, not to mention GetCount can do other tricks that the Python code isn't doing like seeing if there is a selection set on the table or layer, and if so just asking for the length of the list of selected records without needing to open a cursor on the actual data.
... View more
03-25-2014
12:18 PM
|
1
|
0
|
2259
|
|
POST
|
Please, please, please use James' GetCount solution: result = int(arcpy.GetCount_management(fc).getOutput(0))
It will be the fastest.
... View more
03-21-2014
09:39 PM
|
2
|
0
|
15467
|
|
POST
|
If you go to the BitBucket releases page for the project, you can download a .zip of 0.7
... View more
03-21-2014
09:45 AM
|
0
|
0
|
1782
|
|
POST
|
You're shadowing the built-in list type by defining a variable as list. Don't do list = [], rename it something like cc_list.
... View more
02-21-2014
10:32 AM
|
0
|
0
|
4002
|
|
POST
|
Instead of if type(add_fields) != list: do if not isinstance(add_fields, list): or even better: if isinstance(add_fields, basestring):
... View more
02-21-2014
07:10 AM
|
0
|
0
|
4002
|
|
POST
|
No, it does not mean there is a preference for one or the other. They have different capabilities and one or the other should be used based on how much fine-grained control you need. The lack of a tech session is simply because there is already plenty of documentation online for making Python Add-Ins and the process for making one should be pretty straightforward.
... View more
02-20-2014
05:08 AM
|
0
|
0
|
2013
|
|
POST
|
In a Python Add-In, calling the deactivate() method WILL NOT deactivate the add-in, only the user can. deactivate() is called to notify the tool class when the user has selected another tool (such as pan, zoom, etc) in the application as a triggered event.
... View more
02-10-2014
09:20 AM
|
0
|
0
|
1081
|
|
POST
|
This combobox worked without issue for me: # coding: utf-8
import arcpy
import pythonaddins
class ComboBoxClass1(object):
"""Implementation for Dropdown_addin.combobox (ComboBox)"""
def __init__(self):
self.value = "Hello"
self.items = ["Hello", "Goodbye"]
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWW'
self.width = 'WWWWWW'
... View more
02-04-2014
07:50 AM
|
0
|
0
|
827
|
|
POST
|
I'm not seeing any sort of crash, just a failure when calling the TableToTable Tool: >>>
Traceback (most recent call last):
File "C:\...\AssemblyCache\{7E4CFC40-D898-41B3-8BBB-0B634DC2B183}\EsriAddin_addin.py", line 32, in onClick
arcpy.TableToTable_conversion(NullServiceAddresses, Null_Services, "NullServiceAddresses.dbf", "", "ANCILLARYR \"ANCILLARYR\" true true false 2 Short 0 4 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,ANCILLARYROLE,-1,-1;ENABLED \"ENABLED\" true true true 2 Short 0 4 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,ENABLED,-1,-1;WSA \"WSA\" true true false 3 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,WSA,-1,-1;SYNERGEN_I \"SYNERGEN_ID\" true true false 17 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,SYNERGEN_ID,-1,-1;LIFECYCLES \"LifecycleStatus\" true true false 4 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,LIFECYCLESTATUS,-1,-1;LASTEDITOR \"LASTEDITOR\" true true false 10 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,LASTEDITOR,-1,-1;LASTEDITDA \"LASTEDITDA\" true true false 36 Date 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,LASTEDITDATE,-1,-1;LASTEDITSO \"LastEditSource\" true true false 4 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,LASTEDITSOURCE,-1,-1;DOCUMENTNU \"DOCUMENTNU\" true true false 255 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,DOCUMENTNUMBER,-1,-1;INSTALLYEA \"INSTALLYEAR\" true true false 2 Short 0 4 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,INSTALLYEAR,-1,-1;OWNERSHIP \"Ownership\" true true false 4 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,OWNERSHIP,-1,-1;STREETDIR \"STREETDIR\" true true false 3 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,STREETDIR,-1,-1;STREETNO \"STREETNO\" true true false 15 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,STREETNO,-1,-1;STREETNAME \"STREETNAME\" true true false 50 Text 0 0 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,STREETNAME,-1,-1;SERVICESUB \"ServiceSubtype\" true true false 4 Long 0 5 ,First,#,\\ADMIN.PotableNetwork\\ADMIN.Service,SERVICESUBTYPE,-1,-1", "")
File "c:\arcgis\arcpy\arcpy\conversion.py", line 2018, in TableToTable
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Rows: Dataset NullServiceAddresses does not exist or is not supported
Failed to execute (TableToTable).
>>> Perhaps add some print statements in your onClick implementation to see how far the tool gets and where it crashes on your local machine?
... View more
01-31-2014
11:35 AM
|
0
|
0
|
843
|
|
POST
|
arcpy.mapping.ExportReport is only supported on 32-bit versions of ArcGIS. Are you running from ArcGIS for Desktop normally? You may need to reassociate .py files with the 32 bit install's Python installation to make it functional.
... View more
01-27-2014
05:52 PM
|
0
|
0
|
5629
|
|
POST
|
Isn't that what a debugger is for? You could do this, but it's a terrible idea and will slow your program down by orders of magnitude: import inspect import sys def tracefunction(frame, event, arg): if event == "line": info = inspect.getframeinfo(frame) fname, lineno, fn = info.filename, info.lineno, info.function with open(fname, 'rb') as f: line = [line.rstrip() for line in f][lineno - 1] print "Function: {} (in file {}:{}) | {}".format(fname, fn, lineno, line) return tracefunction def registertracefunction(): sys.settrace(tracefunction) registertracefunction() def mainfunction(): for x in xrange(10): print x * 5 if __name__ == "__main__": mainfunction() That is, paste the code up through registertracefunction() line to the top of your script and it will print out every line it's on.
... View more
01-27-2014
11:35 AM
|
0
|
0
|
3030
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-26-2012 02:46 AM | |
| 2 | 01-06-2011 08:22 AM | |
| 1 | 03-25-2014 12:18 PM | |
| 1 | 08-12-2014 09:36 AM | |
| 1 | 03-31-2010 08:56 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|