Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing bad type does not give the location in file #2

Open
SimplyKnownAsG opened this issue Feb 14, 2018 · 0 comments
Open

parsing bad type does not give the location in file #2

SimplyKnownAsG opened this issue Feb 14, 2018 · 0 comments
Assignees

Comments

@SimplyKnownAsG
Copy link
Owner

SimplyKnownAsG commented Feb 14, 2018

The below example demonstrates there is no context reported in the error.

>>> import yamlize
>>> @yamlize.yamlizable(yamlize.Attribute('attr', type=int))
... class Thing(object):
...     pass
...
>>> Thing.load('attr: ')
Traceback (most recent call last):
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\yamlizable.py", line 121, in from_yaml
    new_value = cls.__type(data)  # to coerce to correct type
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\yamlizable.py", line 60, in load
    return cls.from_yaml(loader, node, None)
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\objects.py", line 102, in from_yaml
    self.__from_node(loader, node)
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\objects.py", line 159, in __from_node
    attribute = attrs.from_yaml(self, loader, key_node, val_node, self.__round_trip_data)
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\attribute_collection.py", line 59, in from_yaml
    attribute.from_yaml(obj, loader, val_node, round_trip_data)
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\attributes.py", line 143, in from_yaml
    value = self.type.from_yaml(loader, node, round_trip_data)
  File "C:\Users\gmalmgren\codes\yamlize\yamlize\yamlizable.py", line 127, in from_yaml
    .format(data, cls))
yamlize.yamlizing_error.YamlizingError: Failed to coerce data `None` to type `<class 'yamlize.yamlizable.Yamlizableint'>
@SimplyKnownAsG SimplyKnownAsG self-assigned this Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@SimplyKnownAsG and others