This proposed patch adds the missing ParamValue methods: 
https://github.com/OpenImageIO/oiio/pull/2417 
<https://github.com/OpenImageIO/oiio/pull/2417>



> On Nov 26, 2019, at 11:54 AM, Larry Gritz <l...@larrygritz.com> wrote:
> 
> No, that's not it. How about:
> 
> for inParm in spec.extra_attribs:
>    specCopy.attribute (inParam.name, inParam.type, inParam.value)
> 
> 
> 
>> On Nov 26, 2019, at 11:52 AM, Larry Gritz <l...@larrygritz.com 
>> <mailto:l...@larrygritz.com>> wrote:
>> 
>> Oh, I just realized, another way you can do it right now is that instead of 
>> constructing a ParamValue and adding it to extra_attribs, you can do this:
>> 
>> for inParm in spec.extra_attribs:
>>    specCopy.attribute (inParam.name, inParam.value)
>> 
>> 
>>> On Nov 26, 2019, at 8:58 AM, Larry Gritz <l...@larrygritz.com 
>>> <mailto:l...@larrygritz.com>> wrote:
>>> 
>>> I'm afraid you are right -- at the moment, the python interface only 
>>> exposes ParamValue(name,int), (name,float), and (name,string). It doesn't 
>>> expose the general (name, anything) constructor, so it's probably getting 
>>> tripped up on some compound object.
>>> 
>>> Maybe as a workaround, it would be easier to use 
>>> ParamValueList.remove(name) to just exclude the specific things you want to 
>>> eliminate, rather than add one by one everything else?
>>> 
>>> Also, if this is all you're doing from python, you could try from the 
>>> command line with oiiotool using the --eraseattrib command?
>>> 
>>>     -- lg
>>> 
>>> 
>>>> On Nov 26, 2019, at 5:32 AM, ha...@haggi.de <mailto:ha...@haggi.de> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> we try to get rid of the huge crypto matte headers in exr files and 
>>>> instead load the data from an external file.
>>>> To eliminate the crypto data I tried to copy the original image spec, 
>>>> clear the extra_attribs and only copy the non crypto data from the origial 
>>>> spec like this:
>>>> 
>>>> localImage = oiio.ImageInput.open("C:/data/crypto.00090.exr")
>>>> spec = localImage.spec()
>>>> specCopy = oiio.ImageSpec(spec)
>>>> specCopy.extra_attribs.clear()
>>>> crypto = {}
>>>> for inParm in spec.extra_attribs:
>>>>    pv = oiio.ParamValue(inParm.name, inParm.value)
>>>>    specCopy.extra_attribs.append(pv)
>>>> 
>>>> If I try it this way I get an error:
>>>> 
>>>> # Error: Python argument types in
>>>> #     ParamValue.__init__(ParamValue, str, str)
>>>> # did not match C++ signature:
>>>> #     __init__(struct _object * __ptr64)
>>>> # Traceback (most recent call last):
>>>> #   File "<maya console>", line 13, in <module>
>>>> # ArgumentError: Python argument types in
>>>> #     ParamValue.__init__(ParamValue, str, str)
>>>> # did not match C++ signature:
>>>> #     __init__(struct _object * __ptr64) #
>>>> 
>>>> In c++ the ParamValue can be initialized with a string and a value, so I'm 
>>>> a bit confused. What's the correct way to add values to a ParamValueList 
>>>> in python?
>>>> 
>>>> 
>>>> haggi
>>>> _______________________________________________
>>>> Oiio-dev mailing list
>>>> Oiio-dev@lists.openimageio.org <mailto:Oiio-dev@lists.openimageio.org>
>>>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
>>>> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>>>> 
>>> 
>>> --
>>> Larry Gritz
>>> l...@larrygritz.com <mailto:l...@larrygritz.com>
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Oiio-dev mailing list
>>> Oiio-dev@lists.openimageio.org <mailto:Oiio-dev@lists.openimageio.org>
>>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org 
>>> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>> 
>> --
>> Larry Gritz
>> l...@larrygritz.com <mailto:l...@larrygritz.com>
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Oiio-dev mailing list
>> Oiio-dev@lists.openimageio.org <mailto:Oiio-dev@lists.openimageio.org>
>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
> 
> --
> Larry Gritz
> l...@larrygritz.com <mailto:l...@larrygritz.com>
> 
> 
> 
> 
> _______________________________________________
> Oiio-dev mailing list
> Oiio-dev@lists.openimageio.org
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

--
Larry Gritz
l...@larrygritz.com




_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to