POST
|
Following the advice of the ESRI people, I called the Administrator to run a "repair" for the ArcGIS Desktop installation. This fixed all issues and the described code worked. Many thanks to all for your helpful comments.
... View more
04-23-2012
08:32 AM
|
0
|
0
|
1015
|
POST
|
Many thanks for your responses. I'm going through the Python training of ESRI right now, and it seems there is some problem with Python in ArcGIS (could it be the installation in my machine?). For example, I'm trying to run this piece of code in Field Calculator: def label(name, type):
if type == "HIGH":
return name + " HS"
elif type == "MIDDLE":
return name + " MS"
elif type == "ELEMENTARY":
return name + " ELEM" with Expression: label( !NAME!, !TYPE! ) and I'm receiving a 999999 error. Even if I put the code that the ESRI training is providing (.cal file), the same error comes up. Sorry to bother you guys with this..., nothing to do with programming..., just the usual ArcGIS bugs.
... View more
04-20-2012
08:28 AM
|
0
|
0
|
1015
|
POST
|
Yes, I am in the Edit session (I tried both in and outside the Edit session). I even tried the following code: Block: import re def replace(value): return re.sub ('Dec20112', 'Dec2011', value) Expression: replace(!Hyperlink!) which did not work either. I'm not a Python expert, but shouldn't this work? Yes, "Find and Replace" is there..., for some reason (frustration for Python not working perhaps?) I didn't see it.
... View more
04-20-2012
05:09 AM
|
0
|
0
|
1015
|
POST
|
In ArcGIS 9.x was in the options..., Find and Replace. In ArcGIS 10.x, we have to use Python script !FieldName!.replace("OldText", "NewText") I may be missing something here, but why on earth the Python script is not working? Here is what I type in the Expression: !Hyperlink!.replace("Dec20112", "Dec2011") , and here is the message from the Geoprocessing results: ERROR 000539: <type 'exceptions.SyntaxError'>: invalid syntax (<expression>, line 1) Failed to execute (CalculateField). I have managed to do the replacing with VBscript: Replace ([Hyperlink], "Dec20112", "Dec2011") Any idea about what may be wrong with Python here? It says PYTHON 9.3; I'm running ArcGIS10sp4 under Win7-64bit. Cheers, Niko
... View more
04-20-2012
03:54 AM
|
0
|
9
|
15958
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|