Skip to content

Instantly share code, notes, and snippets.

@rfairburn
Last active August 29, 2015 14:18
Show Gist options
  • Save rfairburn/30c250f49926cbfb104a to your computer and use it in GitHub Desktop.
Save rfairburn/30c250f49926cbfb104a to your computer and use it in GitHub Desktop.
yamltest.py
#!/usr/bin/env python
import sys
import yaml
from pprint import pprint
filename = sys.argv[1]
with open(filename, 'r') as yaml_file:
try:
yaml_data = yaml.load(yaml_file);
except Exception:
print('Invalid yaml detected.')
sys.exit(1)
pprint(yaml_data)
print('Yaml loaded successfully.')
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment