Questions tagged [error-000539]
Use this tag for Questions which are related to the "000539" error returned by ArcGIS Desktop and ArcGIS Pro.
134
questions
14
votes
8
answers
58k
views
Removing return/newline (\n) character from Field using Python and Field Calculator?
I have a geodatabase table with a field that I'm trying to remove return characters (new line). I found this post (How can I remove (chomp) a newline in Python?) of how to do it, however it is not ...
12
votes
1
answer
2k
views
Using ArcPy with ArcGIS Pro and ArcGIS Desktop on same machine?
I'm just trying out ArcGIS Pro for the first time and I had to change my PYTHONPATH to python34
ArcGIS Pro is now working without crashing every time I open the Analysis tab... However now when I try ...
8
votes
3
answers
2k
views
python script error- with GetParameterAsText [duplicate]
I have a seemingly simple code which iterates through a list of feature classes and calculates an ID field in the attribute table that is equal to the first 5 characters of feature class name. The ...
6
votes
1
answer
617
views
Defining a Python function to calculate a value using multiple fields
I am using the Calculate Field tool in ArcGIS Pro to get it to calculate fire hydrant flow data. I need data from the table fields PitotPressure, COE, and HydrantOrificeFlowed in an attribute table to ...
5
votes
1
answer
660
views
Calculating Polsby-Popper Score Using ArcGIS Pro Field Calculator gives ERROR 000539?
This operation is using the Field Calculator in ArcGIS Pro 2.1.
I am trying to calculate the Polsby-Popper Score for Congressional Districts. I have calculated the Geodesic Area and Geodesic ...
5
votes
1
answer
2k
views
Map Algebra expression in a model fails on open workspace
I have model which runs 2 processes that create rasters and a third process that (attempts to) add the two of them using Map Algebra. The expression is very simple, just "%Raster_A%" + "%Raster_B%".
...
4
votes
2
answers
585
views
Python script in ArcMap Field Calculator giving Error 000539: SyntaxError: Invalid Syntax?
I've been trying to calculate this expression for a field in an attribute table in ArcMap 10.4.1, and keep getting the following error:
Error 000539: SyntaxError: invalid syntax (expression, line ...
4
votes
2
answers
1k
views
Assign field values (double) based on values of other field (string) using field calculator
I want to assign numbers to a field, WScore (double), based on field values of Soils (string). They are in the same table of a raster. I'm not trying to add text to a double. What I want to do is this:...
4
votes
2
answers
728
views
ERROR 000539: Error running expression
I am trying to calculate my End_Streets field within two joined tables. I want to remove the redundant SECONDARYN value from the STREETS field.
" & ".join(!IntersectAndEnds2.Streets!.split(" &...
4
votes
1
answer
2k
views
Why is arcpy.CalculateField_management() writing 1899-12-30 00:00:00 instead of expected date?
I'm using ArcGIS 10.3.1 for Desktop to test before writing an answer to Entering date with arcpy.GetParameterAsText()? I have written the test code below that I am running against a test feature class ...
4
votes
1
answer
535
views
arcpy.CalculateField_management doesn't recognize variable in code block
I found a useful field calculator code block that I'm trying to add to a custom python tool. It works great in the manual field calculator; however, when inserted into the code block text to be used ...
4
votes
1
answer
1k
views
Scale raster in ArcGIS using raster calculator
I have a raster with values ranging from 0 to 8991130624. This raster is actually the result of a cost distance analysis.
I want to scale the raster to range from 0 to 1 and take the inverse? so ...
3
votes
1
answer
6k
views
Receiving error 000539 from CalculateField_management?
I am trying to add (ie "Author", "LastUpdated") to feature classes within a gdb and then populate each of those fields. I have been able to get my code to run properly for the numerical field but I ...
3
votes
3
answers
258
views
Use Calculate Field GP tool to update feature coordinates
ArcMap 10.7.1 (Oracle SDE.ST_GEOMETRY):
I want to use the Calculate Field GP tool to update the coordinates of a polyline FC's shape column.
I have a script that works in a standalone Python IDE (...
3
votes
3
answers
2k
views
Calculate field using variables as fields gives ERROR 000539?
When I calculate a field like this:
field_0="field_name0"
arcpy.CalculateField_management("Layer", field_0, '!field_name1! / !field_name2!', "PYTHON_9.3")
It works! The field "field_name0" in the ...
3
votes
1
answer
6k
views
Why does Raster Calculator (RasterCalculator_sa) give ERROR 000539 in ArcPy?
I am getting a not executed error for a raster calculator. Here is part of the output:
File "C:\projectTemp\FloodAnalysis\floodxsectionanalysis.py", line
107, in makeSeemless
arcpy....
3
votes
3
answers
4k
views
Concatenating strings from two fields using Python in ArcMap Field Calculator?
I'm new to Python scripting and I don't understand what is wrong with this code. I want to concatenate the string values from GRID1MIL and GRID100K. I've created a text column MGRS to begin with.
I ...
3
votes
3
answers
6k
views
Use 'if' statement in ModelBuilder to stop model
I would like to use an if-else statement in my model (along the lines of this Esri blog). My model works fine (several intersects, dissolves, calculating fields, joins). However, I would like to add a ...
3
votes
3
answers
2k
views
Replace occasional Space with Underscore using Python parser of ArcGIS Field Calculator?
I am creating a model which will give me two string values, one which reads exactly what is in a field and another which automatically replaces any Space with an "_". I have used Calculate Value tool, ...
3
votes
1
answer
12k
views
ArcGIS Raster Calculator fails with Error 000539
I have been using Raster Calculator in ArcMap 10.2, today it started returning error 000539 for all actions. Previously it had worked fine. I have not made any change ot my ArcGIS, Python, or Windows ...
3
votes
1
answer
50
views
Automating date creation in field calculator
I am trying to calculate a reinspection date for surveys using the field calculator in ArcGIS Pro.
I am using a predefined survey date and risk zone for this calculation. The risk zones are LOW, MED ...
3
votes
2
answers
359
views
Splitting shapefile based on part of field in attribute table using ArcPy?
I'm new to Python and I need a script that can split my huge shapefile based on a certain attribute.
SO what I have is a big shapefile (over 3M records) with a field named "NISCODE".
In this code are ...
3
votes
2
answers
5k
views
Error msg "Name is not defined" when trying to populate a field with the shape file name
I am trying to populate a field with corresponding file name. For example, if the file name is Route1.shp then the field value will be Route1 as well. However my code is not working. Can you please ...
3
votes
1
answer
873
views
Concatenate fields value excluding empty values
I need to concatenate the value of two fields excluding empty values, using Field calculator. The fields are: AREA_HI and AREA_LO
I have tried using a Python script but ArcGIS returns an error "...
3
votes
1
answer
705
views
Get multiple values from summary tables in Model builder
I working with ModelBuilder and I have two summary statistics tools, with 'case fields' that have multiple sum values, I want to use these sum values from one table and divide the sum values from ...
3
votes
0
answers
342
views
ERROR 000539 from ModelBuilder with Raster Calculator? [closed]
I'm trying to do a math operation in raster calculator using the rasters from other two raster calculators.
My calculation is a simple NDVI formula:
(rastcalc4 - rastcalc3)/(rastcalc4 + rastcalc3)
...
3
votes
1
answer
2k
views
Replacing multiple characters at once
I have a problem with replacing in field calculator.
For some reason my Python parser is not working. So I'm going to use VB and having tonns of this
Replace([field],"x","y")
Replace([field],"z","a")...
3
votes
1
answer
127
views
Python parser of ArcGIS Field calculator returns ERROR 000539: Error running expression?
I like field calculator and use it often, however found something very disturbing today when attempted to do this on a table of 3D feature class.
def abc(shp,id):
return shp.length
-----------------...
3
votes
0
answers
182
views
Arcpy code only works when run in two chunks, not as one piece [closed]
I have a weird thing happening with my script. When I copy/paste it into the python cmd line within ArcMap, I get error messages. However, if I run the first part, then copy in the very last line by ...
3
votes
2
answers
1k
views
Can anyone tell me why my field calculator is returning this error?
All I am trying to do is pull into a text field, a section of another text field via:
fieldB = !fieldA![some_index:other_index]
However I keep receiving the error below and I can't figure out why. ...
2
votes
1
answer
1k
views
Normalizing raster using raster calculator raises TypeError
In ArcGIS 10.1 I'm trying to normalize a section of a DEM (digital elevation model) from original values to values ranging from 0 to 100. First I clipped the raster DEM with an irregulary shaped ...
2
votes
2
answers
5k
views
Debugging ERROR 000539 from CalculateField in ArcPy?
I previously successfully used the sample code here: How to calculate Field using part of filename in ModelBuilder?
# Import standard library modules
import arcpy, os, sys
from arcpy import env
# ...
2
votes
1
answer
185
views
Calculating NDVI
I would like to calculate the NDVI for an area to identify vegetation cover over a 32 year period using. However, I am having challenges with the calculations I have attempted with Raster Calculator. ...
2
votes
1
answer
350
views
Correct expression syntax for filling field with string in calculate field in ArcPy?
I am attempting to populate fields on two different feature classes with different strings that I have stored in a list. I would like to just put the strings and feature classes into a for loop, but ...
2
votes
2
answers
338
views
Calculate field in a joined table in ArcPy
EDIT: I was able to solve the problem with the dictionary approach suggested by @BERA. However, I still don't get why it does not work with the CalculateField method.
I'm trying to calculate a field ...
2
votes
1
answer
138
views
Python codeblock to remove numeric characters from a column not working
I am trying to make use of a codeblock found in this thread:
Removing numeric characters from alphanumeric value in field calculation?
I put this code into the pre-logic script field of the field ...
2
votes
1
answer
1k
views
if/then with VBScript in ArcGIS Field Calculator giving Error 000539: SyntaxError: invalid syntax?
What is wrong with this VBscript in the field calculator?
ColumnC=
if [ColumnB] > 0 then
[ColumnC] = [ColumnA] / [ColumnB]
endif
Each time I receive this syntax error message:
Error ...
2
votes
1
answer
778
views
Debugging error 000539 from ArcGIS Field Calculator?
What am I doing wrong in this field calculator logic?
Pre-logic
def re_score(elev_t,f2, contour):
f2=contour
if elev_t.endswith('.5'):
f2 = "Midi"
return f2
Expression for field "Contourtyp"
...
2
votes
1
answer
1k
views
Putting multiple lines of Python into ArcGIS 10's Field Calculator
Entering these lines of Python one at a time works like a charm... Just need one more seemingly simply issue solved...
How do we place multiple lines of Python code into ArcGIS's Field Calculator ...
2
votes
1
answer
227
views
Using RasterCalculator in ArcGIS Pro ModelBuilder gives ERROR 000539
As part of a larger model for iterating lake bathymetry interpolations, I'm essentially trying to establish the lake altitude as a new base level (Z=0) for the DEM surrounding the lake. (picture below ...
2
votes
1
answer
1k
views
ERROR 000539: Invalid Field !FULLNAME
I am very new to Python and my first attempt hasn't gone too well. I'm trying to overwrite a field that is a spatial join of a couple of features in order to, in the end, generate a beginning and ...
2
votes
1
answer
9k
views
Converting values in datetime field to strings in text field using Python parser of ArcGIS for Desktop?
In the attribute table of my file geodatabase feature class I have a populated field called DateField of type date, and a text field called TextField.
I have not yet hit on a way to convert the dates ...
2
votes
2
answers
293
views
How to calculate multiple variables with precondition
I want to do multiple "calculate values" in ModelBuilder.
To make it simple let´s take only 2 simple calculations:
1) calculate sine from angle to variable "MySinus"
2) use this value in a second ...
2
votes
2
answers
831
views
Using Feature Class name to populate new field
I am trying to get the Feature Class name (from Iterate Feature Classes) into a new field. I have been following the models described in the following two threads.
Using Value from Iterate Feature ...
2
votes
4
answers
1k
views
Field Calculator Python Expression Issues
I'm pretty new to Python and this is my first post on this forum so I could use some help. I am currently attempting to run some code in the Field Calculator in a model in order to replace string ...
2
votes
1
answer
478
views
Using Function in Field Calculator gives error 000539?
I'm trying to populate a field using a function. When I run this in Pyscripter, it works fine:
d = {}
# Function #
def find_dups(val):
d[val] = d.setdefault(val, -1) + 1
return d[val]
#
...
2
votes
1
answer
106
views
ArcGIS Field Editor if/else syntax with python
I am just starting with Python and ArcGIs so here is my question:
I have the column "DB_Low" (Type "Long") and want to fill a new column by changing values. The new column will be a Float-Type field.
...
2
votes
1
answer
3k
views
Cause of ERROR 000539: Error running expression?
The following errors in ArcMap are preventing me from moving forward:
1) In Raster Calculator using "Aspect": "%DEM_Aspect%" <= 90 or "%DEM_Aspect%" >= 270
ERROR 000539: Error running ...
2
votes
2
answers
142
views
Call field from zip() into Field Calculator expression ArcGIS
I've been trying to find a way to call in field names from a zip(). Basically I have 12 fields called "Flw_days1", "Flw_days2" etc and corresponding "Depth" fields that need to be calculated using the ...
2
votes
1
answer
5k
views
Getting ValueError: max() arg is an empty sequence on a Python Script in the Field Calculator in ArcMap
I have a script that populates a FacilityID Field on a Attribute table in the Field Calculator but when I run the script below I am getting a error.
Python Script:
def autoInc():
import arcpy, os
...