Custom Query (121 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (31 - 33 of 121)

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
#54 fixed load() fails to load consecutive documents xi cems at lanl dot gov

Reported by cems at lanl dot gov, 7 years ago.

Description

Description: if a file contains multiple documents, yaml.load() fails to work after the first document is read.

I have a text file called test.yml that looks like this: --- as: "333 775260" --- zz: "top"

the following code works as expected:

f = open("test.xml") x = yaml.load_all(f) [ i for i in x]

that loads both documents. it does it lazily using a generator x.

The following does NOT work as exepcted: f = open("test.xml") yaml.load(f) yaml.load(f)

the first yaml.load(f) works and loads the first document. the second one fails. From the documentation I beleive yaml.load should consecutively load the next document upon each invocation on the stream. The error message upon failing to load varies depending upon what is in the second document. In the case shown here is the stack trace from ipython2.5

In [153]: f = open("test4.yml")

In [154]: yaml.load(f) Out[154]: {'as': '333 775260'}

In [155]: yaml.load(f)


<type 'exceptions.AttributeError?'> Traceback (most recent call last)

/Users/cems/Documents/Collaboration/brettin/poisson_estimates/ace_to_yaml/<ipython console> in <module>()

/sw/lib/python2.5/site-packages/yaml/init.py in load(stream, Loader)

64 loader = Loader(stream) 65 if loader.check_data():

---> 66 return loader.get_data()

67 68 def safe_load_all(stream):

/sw/lib/python2.5/site-packages/yaml/constructor.py in get_data(self)

36 # Construct and return the next document. 37 if self.check_node():

---> 38 return self.construct_document(self.get_node())

39 40 def g(): yield None

/sw/lib/python2.5/site-packages/yaml/composer.py in get_node(self)

21 # Get the root node of the next document. 22 if not self.check_event(StreamEndEvent?):

---> 23 return self.compose_document()

24 25 def compose_document(self):

/sw/lib/python2.5/site-packages/yaml/composer.py in compose_document(self)

33 34 # Compose the root node.

---> 35 node = self.compose_node(None, None)

36 37 # Drop the DOCUMENT-END event.

/sw/lib/python2.5/site-packages/yaml/composer.py in compose_node(self, parent, index)

50 return self.anchors[anchor] 51 event = self.peek_event()

---> 52 anchor = event.anchor

53 if anchor is not None: 54 if anchor in self.anchors:

<type 'exceptions.AttributeError?'>: 'NoneType?' object has no attribute 'anchor'

In [156]:

#60 fixed Error loading timestamps xi miki@…

Reported by miki@…, 7 years ago.

Description

Try the following script:

#!/usr/bin/env python

import syck
from datetime import datetime

for i in range(10000):
    now = datetime.now()
    dumped = syck.dump(now)
    loaded = syck.load(dumped)
    if now != loaded:
        print "original:", now
        print "result:", loaded
        print "dump:", dumped
        break

I get:

original: 2007-09-17 11:04:08.091612
result: 2007-09-17 11:04:08.916120
dump: --- !timestamp 2007-09-17T11:04:08.091612

The YAML looks OK, so the parsing is wrong.

#62 fixed value token of single period ('.') is parsed incorrectly, throws wrong exception xi sproaticus

Reported by sproaticus, 7 years ago.

Description

A scalar value token consisting of just a period ('.') is interpreted as a float value. When construct_yaml_float() creates a float using this value, it throws an uncaught ValueError instead of yaml.YAMLError

(Also, what's PIL doing in the stack? I didn't import it.)

>>> yaml.load('yaml: .')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 66, in load
    
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 38, in get_data
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 46, in construct_document
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 394, in construct_yaml_map
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 207, in construct_mapping
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 132, in construct_mapping
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 87, in construct_object
  File "build/bdist.linux-i686/egg/yaml/constructor.py", line 281, in construct_yaml_float
ValueError: invalid literal for float(): .

Environment:

  • Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
  • PyYAML-3.05-py2.5.egg
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.