Page 1 of 1

CTYPES error on OSX

Posted: 14 Jan 2018 17:11
by akelian
Hello,


I'm trying to implement a video widget in one of my apps.
In order to familiarise myself with the lib I edited the Qt4 example to Qt5 but I have the following error:


File "xxx/xxx/vlc.py", line 6894, in libvlc_media_player_set_nsobject
return f(p_mi, drawable)

ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type


Process finished with exit code 134 (interrupted by signal 6: SIGABRT)




Any clues ?

Thanks

Re: CTYPES error on OSX

Posted: 19 Jan 2018 13:24
by akelian
Nobody else know, or have this problem ?

Re: CTYPES error on OSX

Posted: 19 Jan 2018 21:27
by RĂ©mi Denis-Courmont
I think that there are not that many Python devs on this forum.

Re: CTYPES error on OSX

Posted: 20 Jan 2018 11:45
by ghalter
I happen to have embedded libVLC into a cross-platform PyQt Application, although PyQt5, could you show how you embed vlc player into pyqt?

Re: CTYPES error on OSX

Posted: 20 Jan 2018 13:46
by akelian
Yes sorry, here is the converted example code (from Qt4 to Qt5) that triggers that error:

https://pastebin.com/j0QPsBUt

If you have any idea shoutout ;)

Re: CTYPES error on OSX

Posted: 20 Jan 2018 19:20
by ghalter
Ah, you have to cast the winID to int:

the line:

Code: Select all

self.mediaplayer.set_nsobject(self.videoframe.winId())
should be:

Code: Select all

self.mediaplayer.set_nsobject(int(self.videoframe.winId()))
your code works fine then on my machine.

Re: CTYPES error on OSX

Posted: 23 Jan 2018 01:07
by akelian
@ghalter Thanks a lot, I don't know how you found that needle but that was it!

To be honest it was not my first attempt but never took the time to post or search more than that. It's been a longtime drawback so big thanks.