8

Is there a way to change the default parser in the Field Calculator to Python?

So annoying to always change now that I'm trying to move away from using VBScript...

I'm using ArcGIS 10.1 for Desktop.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Nov 17, 2013 at 4:32

2 Answers 2

11

I do not think you will find a way to do this because there is an existing, not yet Under Consideration, ArcGIS Idea to have the 'Field Calculator default to Python'.

answered Nov 17, 2013 at 5:19
5

Esri is a little stuck with this because they want to preserve forward compatibility of old Python code people depend on. I really wish they would have changed the default by now though, as we get a lot of queries from users why their scripts fail in background processing -- because the default (VB) is not supported by arcpy 64 bit!

Here's an example wrapper function to use an alternate default parser. For new code, "PYTHON_9.3", not "PYTHON" is arguably the best parser to use in most situations.

import arcpy
def CalculateField2(in_table, field, expression, expression_type="PYTHON_9.3", code_block=None):
 """Calculate Field using PYTHON_9.3 parser as default instead of VB"""
 arcpy.CalculateField_management(in_table, field, expression, expression_type, code_block)
answered Jul 7, 2014 at 17:24
2
  • 5
    You're correct with the backwards compatibility reasons... Just a note though, in ArcGIS Pro, Python will be the only parser option. Commented Jul 7, 2014 at 17:42
  • 1
    Yes, definitely VB is gone in AGP -- since VB isn't supported in 64 bit arcpy -- and ArcGIS Pro is native 64 bit!! Commented Jul 7, 2014 at 18:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.