Custom Query (121 matches)
Results (76 - 78 of 121)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #40 | worksforme | incomplete dict constructor | xi | dvd@… |
| Description |
Hi all, I'm puzzled by a strange behavior of yaml If you run the attached script you obtain an output like this: {'date': '732638', 'fields': {}, 'guid': '0000010f153544cf8a314808007f000000000001', 'expiration': None} {'date': '732638', 'fields': {'': {}, 'it': {'title': 'Hello World'}}, 'guid': '0000010f153544cf8a314808007f000000000001', 'expiration': None} *Please note the 'fields' value (I wrap the output to increase legibility)* the first line is printed inside this custom constructor function: def news_constructor(loader, node): nodes = loader.construct_mapping(node) print nodes return nodes the second line (the correct one) is the print of the return values of this function Can you help me or explain me this strange behavior? |
|||
| #59 | worksforme | Load yaml data as utf-8 strings into a dictionary | xi | dukebody@… |
| Description |
Hello, I'm looking for support, but I don't know if this is the right place to ask. I'm using PyYAML to load some nested data from an utf-8 encoded file in Python with: import yaml
stream=file('data.yaml','r')
data=yaml.load(stream)
The data variable becomes a dictionary with unicode values where is needed. What I want is to put utf-8 strings instead of unicode values to use this data with another library: Cheetah. If I try to use the unicode-type dictionary generated by default with PyYAML I get an UnicodeDecodeError, because de Cheetah strings are in iso-8859-15 and Python tries to decode them to Unicode using ASCII charset tables, so it obiously fails. Is there any way to get an utf-8 coded dictionary? |
|||
| #112 | worksforme | error on help() | xi | donny.viszneki@… |
| Description |
Using Windows XP and Python 2.5.1 C:\Documents and Settings\Joe Sizlack\Desktop\hackers>easy_install pyyaml
Searching for pyyaml
Reading http://pypi.python.org/simple/pyyaml/
Couldn't find index page for 'pyyaml' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Reading http://pypi.python.org/simple/PyYAML/
Reading http://pyyaml.org/wiki/PyYAML
Best match: PyYAML 3.07
Downloading http://pyyaml.org/download/pyyaml/PyYAML-3.07.win32-py2.5.exe
Processing PyYAML-3.07.win32-py2.5.exe
creating 'c:\docume~1\joesiz~1\locals~1\temp\easy_install-5slfsi\PyYAML-3.07-py2
.5-win32.egg' and adding 'c:\docume~1\joesiz~1\locals~1\temp\easy_install-5slfsi
\PyYAML-3.07-py2.5-win32.egg.tmp' to it
Moving PyYAML-3.07-py2.5-win32.egg to c:\python25\lib\site-packages
Adding PyYAML 3.07 to easy-install.pth file
Installed c:\python25\lib\site-packages\pyyaml-3.07-py2.5-win32.egg
Processing dependencies for pyyaml
Finished processing dependencies for pyyaml
C:\Documents and Settings\Joe Sizlack\Desktop\hackers>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> help(yaml)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python25\lib\site.py", line 346, in __call__
return pydoc.help(*args, **kwds)
File "C:\Python25\lib\pydoc.py", line 1645, in __call__
self.help(request)
File "C:\Python25\lib\pydoc.py", line 1689, in help
else: doc(request, 'Help on %s:')
File "C:\Python25\lib\pydoc.py", line 1481, in doc
pager(title % desc + '\n\n' + text.document(object, name))
File "C:\Python25\lib\pydoc.py", line 324, in document
if inspect.ismodule(object): return self.docmodule(*args)
File "C:\Python25\lib\pydoc.py", line 1072, in docmodule
contents.append(self.document(value, key, name))
File "C:\Python25\lib\pydoc.py", line 325, in document
if inspect.isclass(object): return self.docclass(*args)
File "C:\Python25\lib\pydoc.py", line 1196, in docclass
lambda t: t[1] == 'method')
File "C:\Python25\lib\pydoc.py", line 1146, in spill
name, mod, object))
File "C:\Python25\lib\pydoc.py", line 326, in document
if inspect.isroutine(object): return self.docroutine(*args)
File "C:\Python25\lib\pydoc.py", line 1257, in docroutine
doc = getdoc(object) or ''
File "C:\Python25\lib\pydoc.py", line 82, in getdoc
result = inspect.getdoc(object) or inspect.getcomments(object)
File "C:\Python25\lib\inspect.py", line 521, in getcomments
lines, lnum = findsource(object)
File "C:\Python25\lib\inspect.py", line 510, in findsource
if pat.match(lines[lnum]): break
IndexError: list index out of range
>>>
|
|||
