Field Calculator Error 999999

1150
8
Jump to solution
05-14-2020 02:27 PM
PaceFarbstein
New Contributor

Hi, I've been trying to use a simple python script to replace values in a field. I am trying to abbreviate "court" to "CT" "Road" to "RD" and so on. The expression is valid but I still encounter the error. Rarely, it works, but most of the time I get an error message. Thanks!

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

Make sure you don't have any NULLs in the field because they will be converted to Python NoneType and that will cause an error.

View solution in original post

8 Replies
JoshuaBixby
MVP Esteemed Contributor

Looking at your screenshot, there appears to be a space between the module name, re, and the function you are calling, sub.  Is that space really there or is it some artifact on the screen?  (Note, there should not be a space)

0 Kudos
PaceFarbstein
New Contributor

Hi Joshua,

That is just an artifact on the screen. This is what it looks like in the code block:

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Make sure you don't have any NULLs in the field because they will be converted to Python NoneType and that will cause an error.

PaceFarbstein
New Contributor

thank you, this worked.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Glad you got it working.  Please mark a response as the Correct Answer or mark the question as Assumed Answered to close it out.

0 Kudos
DrewFlater
Esri Regular Contributor

Hello Pace FarbsteinJoshua Bixby

Can you describe what version you are seeing the error 999999 with this calculate field case? A few releases ago we added code to catch this NoneType error and raise a warning. If you are still seeing the issue in 2.5 I would love to better understand your data and repro case. Thanks

Error as of 2.5 that results from the replace() Nonetype exception:

2020-05-18_15-24-46

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Drew Flater‌, your screenshot isn't viewable, at least by me.  I ran some test code and see a WARNING 002858, which I assume is now the expected result.

When I first replied to the OP, I didn't try to reproduce his error, I provided the comment on NULL since it was a historical issue with Pro and Field Calculator.

0 Kudos
DrewFlater
Esri Regular Contributor

Thanks very much Joshua Bixby‌, my pictured error was the same Warning 00258. Glad that you are seeing the same warning now instead of the dreaded unhandled error 999999.

0 Kudos