Custom Query (132 matches)


Show under each result:

Results (31 - 33 of 132)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Ticket Resolution Summary Owner Reporter
#167 worksforme Please help saving dict to yaml xi anonymous

Reported by anonymous, 4 years ago.

Hi, is there any way of saving dict to a file in yaml format? I'm using:
import yaml
y = """
         - subject1:
            desc: msg1
         - subject2:
            desc: msg2

settings['root'][0]['subject1']['desc'] = "new msg"
print settings

f = open("temp", "w")
but failing miserably, contents of the temp file:
{'root': [{'subject1': {'desc': 'new msg'}}, {'subject2': {'desc': 'msg2'}}]}

expected result:
         - subject1:
            desc: new msg
         - subject2:
            desc: msg2

Is there anything like Any help greatly appreciated!

#170 fixed PyYAML 3.09 + Python 2.7 — easy_install installation broken, binary installer absent xi anonymous

Reported by anonymous, 4 years ago.

C:\Python27\Scripts>easy_install.exe pyyaml
install_dir c:\Python27\Lib\site-packages\
Searching for pyyaml
Best match: PyYAML 3.09
Running PyYAML-3.09\ -q bdist_egg --dist-dir d:\temp\easy_install-02p1z8\PyYAML-3.09\egg-dist-tmp-6im7x1
Creating lexicon...
Done (0.03 seconds)
error: Setup script exited with error: SandboxViolation: open('c:\\Python27\\lib\\site-packages\\pyrex-0.9.9-py2.7.egg\\Pyrex\\C
ompiler\\Lexicon.pickle', 'wb') {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
#173 invalid Python regular expression named groups breaks (?) pyyaml xi anonymous

Reported by anonymous, 3 years ago.


I'm using pyyaml 3.09 in Python 2.6.5 on Ubuntu 10.04 LTS.

I have a yaml file I used for configuration of a web server (tornado), and the section of my file causing issues looks like this:

  # [ path, handler class, [whitelist] ]
   - [/stats, myapp.core.Stats, [,]]
   - [r'/(?P<id>.*)', myapp.core.Foo, [,]]
   - [/.*, myapp.core.MainHandler, []]

When this gets loaded, pyyaml yells at me. Here's a python interpreter session:


Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> stream = open('etc/subzero.yaml')
>>> config = yaml.load(stream)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-i686/egg/yaml/", line 58, in load
  File "build/bdist.linux-i686/egg/yaml/", line 42, in get_single_data
  File "build/bdist.linux-i686/egg/yaml/", line 36, in get_single_node
  File "build/bdist.linux-i686/egg/yaml/", line 55, in compose_document
  File "build/bdist.linux-i686/egg/yaml/", line 84, in compose_node
  File "build/bdist.linux-i686/egg/yaml/", line 133, in compose_mapping_node
  File "build/bdist.linux-i686/egg/yaml/", line 82, in compose_node
  File "build/bdist.linux-i686/egg/yaml/", line 111, in compose_sequence_node
  File "build/bdist.linux-i686/egg/yaml/", line 82, in compose_node
  File "build/bdist.linux-i686/egg/yaml/", line 110, in compose_sequence_node
  File "build/bdist.linux-i686/egg/yaml/", line 93, in check_event
  File "build/bdist.linux-i686/egg/yaml/", line 479, in parse_flow_sequence_entry
yaml.parser.ParserError: while parsing a flow sequence
  in "etc/myapp.yaml", line 35, column 5
expected ',' or ']', but got '?'
  in "etc/myapp.yaml", line 35, column 10


Line 35 is:

   - [r'/(?P<id>.*)', myapp.core.Foo, [,]]

I'm wondering why it's choking here. Disabling this line causes everything to work perfectly well. The question mark is a special case in YAML, but (I thought) only when it's accompanied by a space. I don't recall ever needing to escape anything inside of a yaml file, but I tried escaping the '?'. Not sure what to try next. If I double-quote like "r'/(?P<id>.*)'" then it'll be a double-quoted string on the other end of the load as well, which doesn't help me.

Clue hereby solicited.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Note: See TracQuery for help on using queries.