Skip to content

ck2yaml and cti2yaml require Python 3, breaking builds that use system Python 2 #669

@bryanwweber

Description

@bryanwweber

Cantera version

2.5.0a3

Operating System

Any

When building from source, either Python 2 or Python 3 should be able to be used to run SCons. The new ck2yaml and cti2yaml scripts depend on Python 3 features. The build script relies on at least ck2yaml to convert CHEMKIN input files to the YAML format, so builds that use Python 2 to run SCons and don't specify a python_cmd that is a Python 3 executable result in errors. One of them is documented on the Google Group:

scons: Building targets ...
"/usr/bin/python" interfaces/cython/cantera/ck2yaml.py --quiet --no-validate --input=data/inputs/gri30.inp --output=build/data/gri30.yaml --transport=data/transport/gri30_tran.dat
  File "interfaces/cython/cantera/ck2yaml.py", line 177
    def __init__(self, *, Tmin, Tmax, Tmid, low_coeffs, high_coeffs, note=''):
                        ^
SyntaxError: invalid syntax
scons: *** [build/data/gri30.yaml] Error 1
scons: building terminated because of errors.

Steps to reproduce

  1. Run SCons with a Python 2 sys.executable and do not specify a Python 3 executable in python_cmd

One possible solution to this is to check the YAML files into the repository rather than creating them during the build process. Another option is to make the scripts compatible with Python 2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions