Modify

Ticket #68 (closed defect: wontfix)

Opened 7 years ago

Last modified 6 years ago

PyYAML don't load datetime objects dumped with PySyck

Reported by: miki@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

>>> from datetime import datetime
>>> now = datetime.now()
>>> import syck
>>> a = {"t": now}
>>> yaml.load(syck.dump(a))

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    lib.yaml.load(syck.dump(a))
  File "yaml/__init__.py", line 66, in load
  File "yaml/constructor.py", line 38, in get_data
  File "yaml/constructor.py", line 46, in construct_document
  File "yaml/constructor.py", line 394, in construct_yaml_map
  File "yaml/constructor.py", line 207, in construct_mapping
  File "yaml/constructor.py", line 132, in construct_mapping
  File "yaml/constructor.py", line 87, in construct_object
  File "yaml/constructor.py", line 410, in construct_undefined
ConstructorError: could not determine a constructor for the tag '!timestamp'
  in "<string>", line 2, column 4:
    t: !timestamp 2007-10-19T14:08:44.5 ... 
       ^

Attachments

Change History

comment:1 Changed 6 years ago by xi

  • Status changed from new to closed
  • Resolution set to wontfix

It's correct: !timestamp is YAML 1.0 syntax while PyYAML supports YAML 1.1 only. In YAML 1.1, it should become !!timestamp.

It would be great if PyYAML supports YAML 1.0, but that's another story...

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.