Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

dump produces malformed yaml? #21

Closed
lolmaus opened this issue Nov 14, 2015 · 2 comments
Closed

dump produces malformed yaml? #21

lolmaus opened this issue Nov 14, 2015 · 2 comments

Comments

@lolmaus
Copy link

lolmaus commented Nov 14, 2015

yaml.dump({
  attributes: {
    image-url: "http://www.2do2go.ru/uploads/full/a99dca2d765bb9c034ea8fbf315a48b2_w960_h2048.jpg",
    position: 6
  }
})

Expected output:

---
attributes:
  image-url: "http://www.2do2go.ru/uploads/full/a99dca2d765bb9c034ea8fbf315a48b2_w960_h2048.jpg"
  position: 6

Actual output:

attributes: {image-url: 'http://www.2do2go.ru/uploads/full/a99dca2d765bb9c034ea8fbf315a48b2_w960_h2048.jpg',
  position: 6}

When I try to run actual output in http://codebeautify.org/yaml-validator , it reports:

Error : Malformed inline YAML string "{image-url: 'http://www.2do2go.ru/uploads/full/a99dca2d765bb9c034ea8fbf315a48b2_w960_h2048.jpg'," at line 1 (near "attributes: {image-url: 'http://www.2do2go.ru/uploads/full/a99dca2d765bb9c034ea8fbf315a48b2_w960_h2048.jpg',")
Line : 1  attributes: {image-url: 'http://www.2do2go.ru/uploads/full/a99dca2d765bb9c034ea8fbf315a48b2_w960_h2048.jpg',
@connec
Copy link
Owner

connec commented Nov 15, 2015

Hrm, the result is definitely formatted incorrectly, I'll look into that asap.

It's not malformed, though. The site you linked can't parse some examples from the yaml spec.

@connec
Copy link
Owner

connec commented Jan 27, 2016

So, this is the format that PyYAML dumps to by default. I'm closing this ticket in favour of #25 which covers other cases of dodgy default formatting.

@connec connec closed this as completed Jan 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants