Skip to content

Instantly share code, notes, and snippets.

@deeheber
Forked from dev-dull/yams_test.py
Created May 22, 2020 20:16
Show Gist options
  • Save deeheber/effd5873050e3b4b01b74a54dd4c329f to your computer and use it in GitHub Desktop.
Save deeheber/effd5873050e3b4b01b74a54dd4c329f to your computer and use it in GitHub Desktop.
Simple script to test format validity of yaml files.
import sys
import yaml
# sample usage:
# user@shell$ python3 yams_test.py file1.yaml file2.yaml file3.yaml
print(sys.argv)
for fname in sys.argv[1:]:
fin = open(fname, 'r')
yams = fin.read()
fin.close()
try:
yaml.load(yams)
print('%s Success!' % (fname,))
except Exception as e:
raise e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment