Created
June 14, 2018 15:38
-
-
Save fiddyspence/43af0e9140168015bc4fa4b3f0138968 to your computer and use it in GitHub Desktop.
danger will yamlson, danger
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
$ irb | |
irb(main):001:0> require 'yaml' | |
=> true | |
irb(main):002:0> YAML::load_file 'test.yaml' | |
=> {"foo"=>"bar"} | |
irb(main):003:0> ^D | |
$ python | |
Python 3.6.5 (default, Apr 25 2018, 14:23:58) | |
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import 'yaml' | |
File "<stdin>", line 1 | |
import 'yaml' | |
^ | |
SyntaxError: invalid syntax | |
>>> import yaml | |
>>> with open("test.yaml", 'r') as stream: | |
... try: | |
... print(yaml.load(stream)) | |
... except yaml.YAMLError as exc: | |
... print(exc) | |
... | |
expected a single document in the stream | |
in "test.yaml", line 2, column 1 | |
but found another document | |
in "test.yaml", line 3, column 1 | |
>>> | |
$ cat test.yaml | |
--- | |
foo: bar | |
--- | |
foo: baz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment