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!
Solved! Go to Solution.
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.
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)
Hi Joshua,
That is just an artifact on the screen. This is what it looks like in the code block:
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.
thank you, this worked.
Glad you got it working. Please mark a response as the Correct Answer or mark the question as Assumed Answered to close it out.
Hello Pace Farbstein Joshua 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:
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.
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.