Last active
February 8, 2022 10:15
-
-
Save dmitryd/791c6860660a68736e199891909f9710 to your computer and use it in GitHub Desktop.
Validate YAML file using Python one-liner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c 'import yaml,sys;yaml.safe_load(sys.stdin)' < file.yml | |
Needs "pip install pyyaml". | |
Source: https://liquidat.wordpress.com/2016/01/21/short-tip-verify-yaml-in-shell-via-python-one-liner/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Z:\Cloud\yaml>pip install pyyaml
Requirement already satisfied: pyyaml in c:\users\v-csanders\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (5.3.1)
Z:\Cloud\yaml>python -c 'import yaml, sys;yaml.safe_load(sys.stdin))' < nginx.yaml
File "", line 1
'import
^
SyntaxError: EOL while scanning string literal
Seems like there seems to be a problem with the code, not sure why this does not work.
Todd