import os.path
import types
+if False: # YAML dump debugging code
+ """To help isolate data types etc. that give YAML problems.
+
+ This is usually caused by external C modules (e.g. numpy) that
+ define new types (e.g. numpy.dtype) which YAML cannot inspect.
+ """
+ import yaml.representer
+ import sys
+ def ignore_aliases(data):
+ print data, type(data)
+ sys.stdout.flush()
+ if data in [None, ()]:
+ return True
+ if isinstance(data, (str, unicode, bool, int, float)):
+ return True
+ yaml.representer.SafeRepresenter.ignore_aliases = staticmethod(
+ ignore_aliases)
+
import yaml
from yaml.representer import RepresenterError
continue
try:
yaml.dump((k,v))
- except (TypeError, RepresenterError), e:
+ except RepresenterError, e:
raise NotImplementedError(
- 'cannot convert %s.%s = %s (%s) to YAML'
- % (owner.__class__.__name__, k, v, type(v)))
+ 'cannot convert %s.%s = %s (%s) to YAML\n%s'
+ % (owner.__class__.__name__, k, v, type(v), e))
def _setup_item(self, item):
"""Perform any required initialization before returning an item.
self._ignored_attrs.extend([
'_item_ignored_attrs', '_item_default_attrs',
'_loaded'])
- self._item_ignored_attrs = []
+ self._item_ignored_attrs = ['data']
self._item_default_attrs = {
'command_stack': [],
- 'data': None,
'driver': None,
'info': {},
'name': None,