Search code examples
pythoniosmacoswinapicom

Pywin32 (com objects) on Mac


I've got a quick question that I hope someone can help me with.

I'm in the process of creating/planning an app that needs to run cross platform and use a com library from Windows. In the past I've used win32py to run these com objects in a python app, I've been doing a bunch of research finding a solution on Mac but I've had no luck. Ideally I'd like to stay in Python as I already have working code for Python 2.7 working with this library. If there is a solution in another language however, I would like to hear it.

I realize that this sounds almost sort of backwards, but to make a long story short I have to make this com library work on Mac. I'm going to be doing some automated testing of some iOS stuff with the iOS SDK simulator.


Solution

  • COM is Windows only. COM requires extensive use of the Windows registry and WinAPI. I've seen some frameworks emulate or mock COM behavior on other operating systems (e.g. MainWin on Linux/Solaris), but I don't know of one for Mac.

    The win32py module is just a wrapper around WinAPI calls. So if the WinAPI isn't available, win32py won't work.

    Is the logic you need something you can wrap a service around? In other words, can you host a service on a Windows box and have the Mac application invoke the service?