Re: [Pyobjc-dev] NSXPCConnection not working in pyobjc
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2021-08-25 08:21:41
|
> On 25 Aug 2021, at 09:01, Durgaprasad Kelkar <dur...@gm...> wrote: > > Thanks Ronald. > I was using Python 2.7.18. Don’t. Python 2.7 is no longer support by the python developers, and is also no longer support by up-to-date releases of PyObjC. Any fix for these problem won’t end up in a version of PyObjC that works with Python 2.7. > After changing protocol_ext.m for Python2 and adding "{"use_protocol", use_protocol, METH_VARARGS, NULL}," in mod_methods I could use Protocol and attach to NSXPCInterface. > > Now I am having another issue with "NSXPCConnection". > ValueError: NSInvalidArgumentException - [NSXPCConnection sendInvocation]: Block was not compiled using a compiler that inserts type information about arguments. (doSomething:withReply:) > > I could connect to the Security extension from my Objc C code. But from pyobjc sendInvocation fails. XCode and Xcode command line tools are installed on the machine. That’s annoying. I’ll have to investigate further. I don’t know when I’ll get around to doing that though, the first step is to create a complete example project with an extension. Only then I can start debugging this end to end, hopefully including a fix (although that’s far from sure given the issue with defining protocols). It might be possible to use lower-level APIs to communicate with the extension, but that’s not something I’ve ever looked into. Ronald > > > On Tue, Aug 24, 2021 at 12:22 PM Ronald Oussoren <ron...@ma... <mailto:ron...@ma...>> wrote: > > >> On 23 Aug 2021, at 10:06, Durgaprasad Kelkar <dur...@gm... <mailto:dur...@gm...>> wrote: >> >> Hi Ronald, >> Thanks a lot for quick response. >> I don’t have any experience of writing C extension. I have started learning the same. >> I found some blogs explaining this. They are writing .c files and then compiling with python setup.py install >> >> I can’t find any help to compile with Xcode clang compiler. >> Can you please help me out. Any pointers or examples would be helpful. > > I’ve added a complete extension to the documentation (https://pyobjc.readthedocs.io/en/latest/notes/using-nsxpcinterface.html <https://pyobjc.readthedocs.io/en/latest/notes/using-nsxpcinterface.html>). > > Use “python setup.py install” to build and install the C extension. This should work when either Xcode or the Xcode command line tools are installed. > > The example assumes that you only need definition in the core Cocoa frameworks (Foundation, AppKit), you may have to adjust the includes and link flags if you need definitions from other frameworks. > > Ronald > >> >> >> On Sat, 21 Aug 2021 at 3:33 PM, Ronald Oussoren <ron...@ma... <mailto:ron...@ma...>> wrote: >> Sadly enough the issue is not fixed and cannot be fixed. I’ve described the workaround in <https://pyobjc.readthedocs.io/en/latest/notes/using-nsxpcinterface.html <https://pyobjc.readthedocs.io/en/latest/notes/using-nsxpcinterface.html>>, that description assumes you know how to write C extensions. >> >> I’ve closed the the issue at GitHub (https://github.com/ronaldoussoren/pyobjc/issues/256 <https://github.com/ronaldoussoren/pyobjc/issues/256>) as wontfix because there are no public APIs that can be used to register the “extended method signature” information needed by NSXPCInterface. I have filed an issue with Apple about this, but have little hope that this will accomplish anything. And even if my request is granted this would end up in macOS 13 at the earliest. >> >> Ronald >> >>> On 20 Aug 2021, at 11:43, Durgaprasad Kelkar <dur...@gm... <mailto:dur...@gm...>> wrote: >>> >> >>> I am working on NSXPCConnection in Pyobjc. >>> I could not create NSXPCInterface with a protocol. >>> I referred https://stackoverflow.com/questions/52284089/is-it-possible-to-use-pyobjc-with-a-privilved-xpc-helper-tool-and-xpcinterface-a <https://stackoverflow.com/questions/52284089/is-it-possible-to-use-pyobjc-with-a-privilved-xpc-helper-tool-and-xpcinterface-a>. >>> Links given in the answers are not working. >>> Can you give latest links or code snippet for the same. >>> >>> Does issue https://bitbucket.org/ronaldoussoren/pyobjc/issues/256/enable-using-xpcinterface-with-protocols <https://bitbucket.org/ronaldoussoren/pyobjc/issues/256/enable-using-xpcinterface-with-protocols>. is fixed. >>> >>> Any help around this would be helpful. >> >>> _______________________________________________ >>> Pyobjc-dev mailing list >>> Pyo...@li... <mailto:Pyo...@li...> >>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev <https://lists.sourceforge.net/lists/listinfo/pyobjc-dev> >> >> >> — >> >> Twitter / micro.blog: @ronaldoussoren >> Blog: https://blog.ronaldoussoren.net/ <https://blog.ronaldoussoren.net/> > > — > > Twitter / micro.blog: @ronaldoussoren > Blog: https://blog.ronaldoussoren.net/ <https://blog.ronaldoussoren.net/> > <TestProtocol.zip> — Twitter / micro.blog: @ronaldoussoren Blog: https://blog.ronaldoussoren.net/ |