As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [error-000539]

Use this tag for Questions which are related to the "000539" error returned by ArcGIS Desktop and ArcGIS Pro.

Filter by
Sorted by
Tagged with
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 ...
artwork21's user avatar
  • 34.9k
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 ...
LMHall's user avatar
  • 833
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 ...
user10723's user avatar
  • 103
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 ...
532's user avatar
  • 61
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 ...
SteveC's user avatar
  • 745
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%". ...
matt wilkie's user avatar
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 ...
ElenaFF's user avatar
  • 85
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:...
barnyanka's user avatar
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(" &...
hherrmann's user avatar
  • 470
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 ...
PolyGeo's user avatar
  • 64.7k
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 ...
gwhitaker's user avatar
  • 166
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 ...
Julie's user avatar
  • 163
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 ...
kkaszas's user avatar
  • 290
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 (...
User1974's user avatar
  • 1,054
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 ...
multigoodverse's user avatar
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....
Ryan Bertram's user avatar
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 ...
val's user avatar
  • 631
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 ...
Cindy Jayakumar's user avatar
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, ...
E. Ballent's user avatar
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 ...
falcs's user avatar
  • 1,101
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 ...
Darren De Lange's user avatar
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 ...
Aarjen Peeters's user avatar
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 ...
Python-Novice's user avatar
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 "...
toWGS84's user avatar
  • 499
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 ...
JSSR's user avatar
  • 41
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) ...
Charlera's user avatar
  • 173
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")...
Rmn's user avatar
  • 33
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 -----------------...
FelixIP's user avatar
  • 22.4k
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 ...
LGelb's user avatar
  • 41
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. ...
Slw_Stdy_Sqz's user avatar
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 ...
Tadej's user avatar
  • 23
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 # ...
J Louie's user avatar
  • 21
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. ...
Latonya Williams's user avatar
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 ...
mmoore's user avatar
  • 1,016
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 ...
Lara's user avatar
  • 45
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 ...
Alpheus's user avatar
  • 546
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 ...
bubbalouie's user avatar
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" ...
GeorgeC's user avatar
  • 7,944
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 ...
sirgeo's user avatar
  • 1,999
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 ...
gydemov's user avatar
  • 63
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 ...
hherrmann's user avatar
  • 470
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 ...
PolyGeo's user avatar
  • 64.7k
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 ...
Michael Glöckner's user avatar
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 ...
ChrisStockdale's user avatar
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 ...
user avatar
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] # ...
Mike's user avatar
  • 335
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. ...
M.S.'s user avatar
  • 319
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 ...
Jack Bauer's user avatar
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 ...
Catchment_Jack's user avatar
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 ...
yams's user avatar
  • 307