python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < cfg.yaml

If your file contains valid yaml, it will do nothing.

[tmp]$ python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < cfg.yaml

If the file does not contain valid yaml, you'll get a traceback. From that traceback you should be able to identify the problem.

[tmp]$ python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < cfg.yaml
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  ...
could not find expected ':'
  in "<stdin>", line 5, column 1

The traceback contains a lot of lines that are very useful, but near the end you'll find the line number and column of the error.

Get the latest edition of Python in just minutes.
Ash Ash (341)
6 minutes

If it's been a while since you first installed Python, it might be time to check out the latest edition: Python 3. It has plenty of cool new features from data classes to typing enhancements.