Last active
May 22, 2020 20:16
-
-
Save dev-dull/94e4a1c6eb5999778b96eb91881aed81 to your computer and use it in GitHub Desktop.
Simple script to test format validity of yaml files.
This file contains 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
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