Ticket #82 (closed defect: worksforme)

Opened 3 months ago

Last modified 1 month ago

PyYAML raises exception on empty files

Reported by: Miki Tebeka <miki.tebeka@gmail.com> Assigned to: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> fo = open("/dev/null")
>>> import yaml
>>> yaml.load(fo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/yaml/__init__.py", line 66, in load
    return loader.get_data()
  File "/usr/lib/python2.5/site-packages/yaml/constructor.py", line 38, in get_data
    return self.construct_document(self.get_node())
  File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 23, in get_node
    return self.compose_document()
  File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 35, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python2.5/site-packages/yaml/composer.py", line 52, in compose_node
    anchor = event.anchor
AttributeError: 'NoneType' object has no attribute 'anchor'
>>> 

Attachments

Change History

07/29/08 17:27:22 changed by xi

  • status changed from new to closed.
  • resolution set to worksforme.
  • reporter changed from Miki Tebeka <miki.tebeka@gmail.com to Miki Tebeka <miki.tebeka@gmail.com>.

Works for me.

Python 2.5.2 (r252:60911, May  7 2008, 15:19:09) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.load(open('/dev/null'))

Perhaps you are using some older version of PyYAML? 3.04?

07/29/08 17:32:55 changed by anonymous

Works for me as well, thanks :)

BTW: How do I know what is the version of pyyaml I'm using (there is not lib.yaml.version or lib.yaml.VERSION) ?

07/29/08 20:04:23 changed by xi

For a Ubuntu package, you may use dpkg -l python-yaml. I'll add a __version__ variable to the next version.


Add/Change #82 (PyYAML raises exception on empty files)




Change Properties
Action