Blog

Python 2.6 compatibility

With the help of FreeCAD user KeithSloan I was able to track down all instances of python 2.7 specific syntax and standard libraries, so that the current development snapshot of BOLTS for FreeCAD is usable with python 2.6.

Problems were caused by dict comprehensions

a = { k:[] for k in range(10) }

that were only introduced in python 2.7. A 2.6 compatible reformulation of this is

a = dict((k,[]) for k in range(10))

Additionally the importlib was introduced to the standard library only in python 2.7, but there exists a backport for older versions.

The last problem was related to check_output from the subprocess module, which is not present in the python 2.6 standard library.

This allows users with python 2.6 (which is still used a lot e.g. in Ubuntu LTS releases) to use BOLTS for FreeCAD. However for development, the scripts that generate the distributions and the utility script use 2.7 features and it would be a lot of work to make these 2.6 compatible, so I do not plan to do that.

Instead it might be a good idea to look into python 3 compatibility in the long term.

Comments