OK this would actually work to fix the issue. Apologies for spamming the list.

.def("wdas_erase_attribute",
            [] (ImageSpec& spec, const std::string name, TypeDesc
searchtype, bool casesensitive)
                {
                    spec.erase_attribute(name, searchtype, casesensitive);
                }, "name"_a, "searchtype"_a = TypeUnknown,
"casesensitive"_a = false)

On Tue, Jul 14, 2020 at 4:22 PM Andrew Gartner <andrewgart...@gmail.com> wrote:
>
> Yikes nvm, that' a lambda with an empty function body so that doesn't
> fix it. If anyone has any thoughts on the root issue that'd be great
> though
>
> ~Andrew
>
> On Tue, Jul 14, 2020 at 12:49 PM Andrew Gartner <andrewgart...@gmail.com> 
> wrote:
> >
> > Hey Larry (et all),
> >
> > I was trying to use erase_attribute from python in oiio 2.0.x since
> > that's what I'm currently using. Looks like the python function wrap
> > isn't working. No matter what I do with casting things etc. For
> > example
> > ...Load some image and store it's spec via spec()...
> > for attribute in spec.extra_attribs:
> >     if attribute.name == 'oiio:ColorSpace':
> >         spec.erase_attribute(atttribute.name)
> >
> > raises this exception:
> > Traceback (most recent call last):
> >   File "<console>", line 8, in <module>
> > TypeError: erase_attribute(): incompatible function arguments. The
> > following argument types are supported:
> >     1. (self: OpenImageIO.ImageSpec, name:
> > OpenImageIO_v2_0::string_view=u'', type:
> > OpenImageIO.TypeDesc=<TypeDesc 'unknown'>, casesensitive: bool=False)
> > -> None
> >
> > Invoked with: <OpenImageIO.ImageSpec object at 0x7f3808120148>,
> > 'oiio:ColorSpace'
> >
> > I tried passing in the TypeDesc and bool as well and no luck, I putzed
> > around on the oiio side and changed the python wrapping to this and it
> > seemed to work...not sure it's a good patch though.
> >
> > --from py_imagedesc.cpp line 255
> >
> > .def("erase_attribute",
> >             [] (const ImageSpec& spec, const std::string name,
> > TypeDesc searchtype, bool                   casesensitive)  {},
> > "name"_a, "searchtype"_a = TypeUnknown, "casesensitive"_a = false)
> >
> > Thoughts? Apologies for crappy code formatting also I was going to try
> > the latest release branch but looking at the source in github I don't
> > think this bit has changed since 1.6.x or something like that other
> > than formatting.
> >
> > Cheers,
> >
> > ~Andrew
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to