|
POST
|
Hi Matthew, The documentation for 10.1 states that PythonWin is included in the ArcGIS installation media. It appears that PythonWin is NOT included in the installation media that I have. That's an oversight in the documentation. PythonWin is not included in the installation media with ArcGIS 10.1. If anyone is still interested in using PythonWin though see the page Writing Python scripts in the section 'Installing PythonWin' for steps on where to find, install it, etc. In terms of favorite IDEs, I experiment widely, but my tendencies usually bring me back to PyScripter. Wing (and PyScripter) tends to be popular choices among many of my colleagues -Dave
... View more
01-22-2013
09:07 AM
|
0
|
0
|
1686
|
|
POST
|
I installed the 10.1 sp1 the other day and my scripts stopped working. The following error is showing up: Traceback (most recent call last): File "c:\location\script.py", line 10, in <module> import arcpy File "d:\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 24, in <module> from arcpy.toolbox import * File "d:\arcgis\desktop10.1\arcpy\arcpy\toolbox.py", line 485, in <module> from management import ExportTileCache as ExportTileCache_management ImportError: cannot import name ExportTileCache Line 10 states: Import arcpy Line 24 states: from arcpy.toolbox import * Line 485 states: from management import ExportTileCache as ExportTileCache_management In management.py there is no gptooldoc( ' ExportTileCache_managemet ' ). It appears it should be between ExportReplicaSchema, line 914, and ExportXMLWorkspaceDocument but it is not. Makes me wonder if there may be more missing or am I doing something wrong. I have downloaded the sp1 for 10.1 desktop twice and installed several times with no change. The model still works just not the script. Any help would be greatly appreciated. Thank you ExportTileCache should be around line 13688 in management.py (tools are grouped by toolset). How long is the file you have, the version I'm looking at is total 14912 lines. -Dave
... View more
11-15-2012
02:41 PM
|
0
|
0
|
553
|
|
POST
|
thanks, dan for your answer. you're clearly right. but that didn't cause the error. In the meantime, i found the fault: if you want to use keywords for parameter data types, you need the arcgis 10.1 service pack 1. After installing sp1, everything workes fine 🙂 See @ arcgis online help:http://resources.arcgis.com/en/help/main/10.1/index.html#/Defining_parameter_data_types_in_a_Python_toolbox/001500000035000000/ Hi Manuel, Just to re-emphasize that point for anyone else who may come here. The 'descriptive' datatype keywords were localized, and so for example, 'Feature Layer' would not work on a non-English locale. The new keywords were added at 10.1 SP1, so that you could set a datatype to 'GPFeatureLayer' and it would work for anyone who used the tool, regardless of what locale they might be using. Thanks -Dave
... View more
11-15-2012
02:17 PM
|
0
|
3
|
2069
|
|
POST
|
Definitely should not crash. Populating the parameter, as you noted, will help here, as will setting a schema for the parameter. As an alternative to using .save could also just use CopyFeatures_management, which will fail for this case, but that can be then trapped for. Could also use GetParameterAsText (instead of GetParameter) to get the parameter's value. -Dave
... View more
11-15-2012
12:59 PM
|
0
|
0
|
424
|
|
POST
|
Maybe there will be someone from the Arcpy team at SERUG this year I can bug about it :D. It was obviously a deliberate choice to make such a big change. Ill use your method for now Chris. tuple.index is a good solution. Performance is the big reason. Getting the row back in a tuple that you can pull values by index is a much faster approach than creating a row object and then have to make individual calls to get specific values. The approach of forming a dictionary and then pulling values out from that is okay, but that is adding overhead just to enhance readability. I would much rather just add code comment(s) if I need to clarify which field value is which. -Dave
... View more
11-13-2012
10:55 AM
|
0
|
0
|
262
|
|
POST
|
Hi Kevin, If you have a few minutes, perhaps check out the training seminar on Python toolboxes that we did last week: it will walk through some of these questions you have: http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&courseID=2523 If you're looking for additional samples just to see, check out http://esriurl.com/pyt1, http://esriurl.com/pyt2, http://esriurl.com/pyt3 -Dave
... View more
09-05-2012
09:08 AM
|
0
|
0
|
2994
|
|
POST
|
Hi, Does anyone know how to add the rule "Must Coincide With (Point-Point)" to a topology using AddRuleToTopology_management? I get the folowing error: ERROR 000800: The value is not a member of Must Not Have Gaps (Area) | Must Not Overlap (Area) | Must Be Covered By Feature Class Of (Area-Area) | Must Cover Each Other (Area-Area) | Must Be Covered By (Area-Area) | Must Not Overlap With (Area-Area) | Must Be Covered By Boundary Of (Line-Area) | Must Be Covered By Boundary Of (Point-Area) | Must Be Properly Inside (Point-Area) | Must Not Overlap (Line) | Must Not Intersect (Line) | Must Not Have Dangles (Line) | Must Not Have Pseudo-Nodes (Line) | Must Be Covered By Feature Class Of (Line-Line) | Must Not Overlap With (Line-Line) | Must Be Covered By (Point-Line) | Must Be Covered By Endpoint Of (Point-Line) | Boundary Must Be Covered By (Area-Line) | Boundary Must Be Covered By Boundary Of (Area-Area) | Must Not Self-Overlap (Line) | Must Not Self-Intersect (Line) | Must Not Intersect Or Touch Interior (Line) | Endpoint Must Be Covered By (Line-Point) | Contains Point (Area-Point) | Must Be Single Part (Line). Failed to execute (AddRuleToTopology). That rule was missing from the tool, but was addressed at 10.0 SP2 as NIM064252 : http://downloads2.esri.com/support/downloads/other_/arcgis-10sp2-issues.htm -Dave
... View more
05-24-2012
11:11 AM
|
0
|
0
|
614
|
|
POST
|
Hi Matthew, Edit: Question. Why wouldn't it ship with the latest version of Python (2.7.3), since ArcGIS hasn't been officially released yet? Were the differences too minor? Really just a matter of timing. Lock-down on ArcGIS 10.1 came before Python 2.7.3 had its final release. -Dave
... View more
05-23-2012
11:57 AM
|
0
|
0
|
1418
|
|
POST
|
The final release of 10.1 will include Python 2.7.2. -Dave
... View more
05-23-2012
10:49 AM
|
0
|
0
|
1418
|
|
POST
|
Hi Todd, You could use the datetime object directly, sort of like below
arcpy.CalculateField_management("selectLyr", "UpdDate", `datetime.datetime.now()`, "PYTHON")
-Dave Note: I'm using backtick's around the datetime when pushing it into the tool (just stating this in case that isn't obvious)
... View more
05-08-2012
08:57 AM
|
0
|
0
|
393
|
|
POST
|
I am trying to create a Python Toolbox in ArcGIS 10.1 and can't seem to replicate something like what I see in the Summary Statistics tool where the user builds a Value Table that contains a list of Fields and then within the table the user must pick from a list of valid Statistic types (SUM, MEAN, etc). Anyone have an idea or experience doing this? Thanks. Unfortunately, adding a drop-down of keywords is not supported at the moment in a Python toolbox value table parameter. The way it's implemented right now, the closest that can be done would be to validate the column in updateMessages and add messages to the parameter indicating the choices. Admittedly that's far from ideal. If you want to create an exact match of the Summary Statistic tool's value table parameter that is a little easier. You could mine the parameter from the tool using the arcpy.GetParameterInfo function and use that in python toolbox tool's getParameterInfo. Something like this below:
def getParameterInfo(self):
in_table = arcpy.Parameter(
name="in_table",
displayName="Input Table",
datatype="Table View",
direction="Input",
parameterType="Required")
stats_field = arcpy.GetParameterInfo("Statistics_analysis")[2]
stats_field.parameterDependencies = [in_table.name]
return [in_table, stats_field]
-Dave
... View more
05-08-2012
08:22 AM
|
0
|
0
|
1836
|
|
POST
|
Hi Bjorn. Short answer: execute 'import arcpy' from the Python Interpreter window and the arcpy.da dropdown's will appear. Background: The overriding goal for the data access module was speed. As I'm sure you're aware the older cursor model wasn't nearly as fast. As part of that, arcpy.da doesn't have the Python wrappers that provide the dropdown's that you see in most of arcpy. Essentially, it was a trade-off between speed and IDE-friendliness, and in this case the criterion dictated speed trump. -Dave
... View more
05-08-2012
08:03 AM
|
0
|
0
|
2477
|
|
POST
|
Python window indentation, is actually Indented. Finally, you guys fixed this limitation, and it seems the list that is printed is single space, which is much cleaner.
for fld in arcpy.ListFields ("Table"):
print fld.name
Hi Ted, We spent some time refining the Python window experience for 10.1. Some of that was ported back to service pack 4 as well. -Dave
... View more
12-14-2011
12:46 PM
|
0
|
0
|
446
|
|
POST
|
Thanks very much for the information. Interesting too. I had made a bad assumption that the cursors would just be faster. I will check into the DA module and see if it will help. Hi Tom, There will be some improvement in the speed of the 'classic' cursors, but more of a matter of degree. However, the new arcpy.da cursors will typically show multiple factors of improvement performance-wise over the classic cursors. -Dave
... View more
12-14-2011
09:05 AM
|
0
|
0
|
571
|
|
POST
|
Hi Tom, What was the error mesage you saw when the tool failed? One thing I spotted in your showGpMessage method; just convert that last call to arcpy.GetMessages() def showGpMessage():
arcpy.AddMessage(arcpy.GetMessages())
print >> open(logFile, 'a'), arcpy.GetMessages()
print gp.GetMessages() A couple of things that would give you a time boost ... 1. Remove the UpdateCursor and replace with the TruncateTable_management. 2. Update the script to use cursors in the arcpy.da module (although this is not a direct swap, the signature and techniques vary some). -Dave
... View more
12-13-2011
01:26 PM
|
0
|
0
|
571
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-06-2024 11:22 AM | |
| 2 | 01-31-2024 06:09 PM | |
| 1 | 01-11-2024 02:10 PM | |
| 1 | 05-31-2016 02:41 PM | |
| 2 | 01-05-2015 10:34 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-23-2025
11:14 AM
|