Python and PYAML - yaml.scanner.ScannerError: mapping values are not allowed here

Try putting spaces after the colons.


For anyone who comes here and finds that even if they have spaces after the colon, they still get this error

You can also get this error if you copy the yaml text from some formatted source (for me it was a Slack message). This will invisibly swap in non-ASCII characters that the standard YAML reader can't read, but which look the same.

Solution is to only copy from raw, non-ASCII source.


yaml files do not accept values immediately after the colon mark in the file content. Enter the value after a space, save the file and run again, the error will be gone. I had encountered the similar error during my automation using BDD, and got this fixed after a lot of debugging.