You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "C:\Programming\python\stix\cti-python-stix2\stix2\base.py", line 94, in _check_property
kwargs[prop_name] = prop.clean(kwargs[prop_name])
File "C:\Programming\python\stix\cti-python-stix2\stix2\properties.py", line 180, in clean
valid = self.contained.clean(item)
File "C:\Programming\python\stix\cti-python-stix2\stix2\properties.py", line 472, in clean
_validate_id(value, self.spec_version, required_prefix)
UnboundLocalError: local variable 'required_prefix' referenced before assignment
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 12, in <module>
File "C:\Programming\python\stix\cti-python-stix2\stix2\core.py", line 172, in parse_observable
return obj_class(allow_custom=allow_custom, **obj)
File "C:\Programming\python\stix\cti-python-stix2\stix2\base.py", line 324, in __init__
super(_Observable, self).__init__(**kwargs)
File "C:\Programming\python\stix\cti-python-stix2\stix2\base.py", line 177, in __init__
self._check_property(prop_name, prop_metadata, setting_kwargs)
File "C:\Programming\python\stix\cti-python-stix2\stix2\base.py", line 356, in _check_property
super(_Observable, self)._check_property(prop_name, prop, kwargs)
File "C:\Programming\python\stix\cti-python-stix2\stix2\base.py", line 104, in _check_property
exc,
File "<string>", line 3, in raise_from
stix2.exceptions.InvalidValueError: Invalid value for File 'contains_refs': local variable 'required_prefix' referenced before assignment
I think the cause is the way the contains_refs property is defined:
invalid_types is assigned the empty string. That means in the ReferenceProperty object, both self.valid_types and self.invalid_types are "falsey": the former is None and the latter is the empty string. That means both branches of the if statement in the clean() method are skipped, which means required_prefix is never assigned a value. That causes the UnboundLocalError when it's used in _validate_id().
The text was updated successfully, but these errors were encountered:
To reproduce:
Exception:
I think the cause is the way the contains_refs property is defined:
invalid_types
is assigned the empty string. That means in theReferenceProperty
object, bothself.valid_types
andself.invalid_types
are "falsey": the former isNone
and the latter is the empty string. That means both branches of theif
statement in theclean()
method are skipped, which meansrequired_prefix
is never assigned a value. That causes theUnboundLocalError
when it's used in_validate_id()
.The text was updated successfully, but these errors were encountered: