Dan_Patterson

Field Calculator '*.cal' file encoding ... not '*.py'

Discussion created by Dan_Patterson Champion on Jun 21, 2017
Latest reply on Jan 25, 2018 by Dan_Patterson

The ability to save and reuse python snippets for using in the Calculate Field tools is useful (aka... the field calculator for non-ArcGIS Pro users).  A couple of questions then...

  • UTF-16-LE .... the encoding used for some reason rather than utf-8 for instance

  • UC2-2 LE BOM ... is this good enough if you use a Notepad++ file?
  • -*- coding: <encoding-name> -*-   as the first line using either the UTF or UC2 version... will that solve encoding problems with the *.cal files?

 

And the biggie....Why can't you use Python *.py files?

 

It is more out of curiosity and... I have to teach... so this is what I have to tell my students...

  • the default language used in Pro is Python...
  • Python files have a *.py file extension ...
  • except in the calculate field tool for Pro, 
  • *.cal files is all you will see,
  • save your 'defs' as cal and py files if you want to use them everywhere
  • no more questions now... I have a headache

 

Some illumination would be useful so I can expand my bullet list.  Others that teach out there, may wish to jump in with addition missives should they have encountered any

 

Curtis Price Timothy Hales perhaps, or an FYI##

Outcomes