Re: PyYAML yaml.load() appears to be alphabetizing input
"Alexey Zakhlestin" <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Dictionaries in yamj are not ordered, so the output can be in any implementation-specific order. On 4/26/08, Erich Zigler <[email protected]> wrote: > I am having a frustrating issue with using PyYAML. I am loading the > following yaml file with yaml.load() > > ----- Begin pref.yaml ------- > > hellanzb-pass: changeme > hellanzb-host: localhost > > newzbin-interval: 8 > tvrage-interval: 300 > > # Your news server's retention in days > retention: 110 > > sets: > - shows: > - Some TV Show > - Another TV Show > - "This Show: Quoted because it had a colon" > - Super Awesome Rodent Masters > timezone: US/Eastern > rules: > min-megs: 100 > max-megs: 805 > groups: > - alt.binaries.tv > - alt.binaries.multimedia > > ---- End pref.yaml ------ > > However after I yaml.load() it and then yaml.dump() it to a new file > the following occurs: > > ----- Begin newpref.yaml ----- > > hellanzb-host: localhost > hellanzb-pass: changeme > newzbin-interval: 8 > retention: 110 > sets: > - rules: > groups: > - alt.binaries.tv > - alt.binaries.multimedia > - alt.binaries.multimedia.cartoons > - alt.binaries.multimedia.late-night-talkshows > max-megs: 805 > min-megs: 100 > query: > shows: > - Some TV Show > - Another TV Show > - "This Show: Quoted because it had a colon" > - Super Awesome Rodent Masters > timezone: US/Eastern > tvrage-interval: 300 > > ----- End newpref.yaml ----- > > Why does it jumble things around? > > Here is how I am loading the yaml file: > > stream = file(configfile, 'r') > config = yaml.load(stream) > > I have also tried: > > with open(configfile, 'r') as configuration: > config = yaml.load(configuration) > > What am I missing? > > Thanks! > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Yaml-core mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/yaml-core > -- Alexey Zakhlestin http://blog.milkfarmsoft.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone