pombreda / python-xmp-toolkit

Automatically exported from code.google.com/p/python-xmp-toolkit
Other
0 stars 1 forks source link

UnboundLocalError when calling append_array_item with array_options #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. xmp.append_array_items(namespace, 'foo', 'bar',
array_options=dict(prop_value_is_array=XMP_PROP_VALUE_IS_ARRAY))
2.
3.

What is the expected output? What do you see instead?
Expected an array to get added to the xmp. Instead, got an UnboundLocalError.
UnboundLocalError: local variable 'options' referenced before assignment

What version of the product are you using? On what operating system?
1.0-rc1. But it looks like the current trunk (r39) has this issue too by
looking at the source. I'm on fedora 10, python2.5

Please provide any additional information below.
The issue looks like a simple spelling error. Here's the patch that fixed
it for me:

Index: core.py
===================================================================
--- core.py     (revision 39)
+++ core.py     (working copy)
@@ -269,7 +269,7 @@
                :return True if the array item was appended correctly,
False otherwise.
                :rtype bool
                """
-               array_options = options.mask(XMP_PROP_OPTIONS,
**array_options) if array_options else 0
+               array_options = options_mask(XMP_PROP_OPTIONS,
**array_options) if array_options else 0
                options = options_mask(XMP_PROP_OPTIONS, **kwargs) if
kwargs else 0
                return bool(_exempi.xmp_append_array_item(self.xmpptr,
schema_ns, array_name, array_options, item_value, options))

Original issue reported on code.google.com by rmarian...@gmail.com on 10 May 2009 at 3:50

GoogleCodeExporter commented 9 years ago
Will be in RC2 soon to be released.

Original comment by lniel...@spacetelescope.org on 16 Feb 2010 at 5:00