[Ironpython-users] AttributeError when using methods from a DirectShowLib Interface

Jeff Hardy jdhardy at gmail.com
Sun Apr 26 00:44:47 CEST 2015


On Wed, Apr 8, 2015 at 2:04 PM, Sebastián Magrí <sebasmagri at gmail.com> wrote:
> Hi!
>
> I'm trying to use DirectShowLib for some basic media detection with the
> `IMediaDet` interface. However, trying to use methods of the interface from
> the instance throws `AttributeError` every time.

Hi Sebastián,
Apologies for the delayed response, it's been a busy month.

I'm not sure which DirectShowLib you're using (Google has a few
options) so I'm basing this on code from
https://github.com/larrybeall/DirectShowLib/blob/master/DirectShowLib/DES.cs.

>
> This is the script I'm using to test:
>
> ---
>     import clr
>
>     clr.AddReference('DirectShowLib')
>
>     from DirectShowLib.DES import IMediaDet, DESError
>
>
>     class Detector(IMediaDet):
>         def __init__(self, *args, **kwargs):
>             super(Detector, self).__init__(*args, **kwargs)
>
>
>     mdet = Detector()
>
>     print('Detector: {}\n'.format(mdet))
>     print('Detector dir: {}\n'.format(dir(mdet)))
>     print('Detector.put_Filename: {}\n'.format(mdet.put_Filename))
>     print('Detector.put_Filename dir: {}\n'.format(dir(mdet.put_Filename)))
>     print('Detector.put_Filename.Overloads: {}\n'.format(
>         mdet.put_Filename.Overloads
>     ))
>     print('Detector.put_Filename.Overloads dir: {}\n'.format(
>         dir(mdet.put_Filename.Overloads)
>     ))
>     print('Detector object is instance of IMediaDet: {}\n'.format(
>         isinstance(mdet, IMediaDet)
>     ))
>     mdet.put_Filename('VID_20150207_133726.mp4')
> ---
>
> And it prints the following information, finally throwing an error when I
> try to use the method:
>

I don't know how smart IronPython's COM integration is (DinoV wrote
it) but it's possible its converting the put_/get_ methods to a
property? Try just calling Detector.Filename and see if that works.

- Jeff


More information about the Ironpython-users mailing list