Skip to content


Functionality to facilitate keeping code compatible with Python 2 & Python 3.

Implementations for Python 3.


  • Kenneth Hoste (Ghent University)


Extract method name from lambda function.


Wrapper for json.loads that takes into account that Python versions older than 3.6 require a string value.

load_source(filename, path)

Load file as Python module

raise_with_traceback(exception_class, message, traceback)

Raise exception of specified class with given message and traceback.

safe_cmp_looseversions(v1, v2)

Safe comparison function for two (values containing) LooseVersion instances.


Sort list of (values including) distutils.version.LooseVersion instances.

subprocess_popen_text(cmd, **kwargs)

Call subprocess.Popen in text mode with specified named arguments.

subprocess_terminate(proc, timeout)

Terminate the subprocess if it hasn't finished after the given timeout