[JOB] PyWin32: Getting COM-Server fully working


During many years PyWin32 is the Python module which provides bindings to Windows functions. It also includes a client to access COM services, like CAD or office software. Due to leak of support on some features and documentation around COM server programming with PyWin32 and cx_Freeze I can’t finish up my beloved project I started year(s) ago – creating a sidebar in SolidWorks (VBA), which adopts the sidebar in Cura.

Your chance to get a tip of {XY}€:

If you manage to get the following issues solved, you can earn a tip. However, to earn it all goals need to be achieved. You can share the workload with someone else. But communicate and plan well because I don’t want to deal with disputes about which portion of the tip someone is getting. So to make that clear the tip is NOT per person but per solving all issues mentioned.

Some background

In the past, it was possible to create COM servers with PyWin32 and py2exe. But due to ABI changes in Python 3.5+ py2exe is dead, but it came with some necessary code on a low-level, which allowed the handling of events in the COM server. At least this is what I noticed while reading through old articles and code.

Therefore the only alternative to use is cx_Freeze, BUT that one doesn’t come with the necessary bits to access these events.

The problem

  • Ultimaker Cura uses CPython 3.5 (which will likely be upgraded to something more recent soon), so therefore cx_Freeze is the only way how to get executables for Windows
  • cx_Freeze misses the code to receive events, which we need to get known of changes due to executed function in our server, here Cura
    • At least this is what I noticed in my investigations when comparing cx_Freeze and py2exe
  • I also miss good documentation about the whole creation of a fully-featured COM server
    • One of the missing pieces is the creation and definition of IDL files [1]. These are used to describe the accessible functions and events in your COM server. However, I got it never to work that Visual Studio suggests functions or events the way I defined them in the *.idl file before, which I compiled.

The goal

… is pretty clear. All I want everything that solves these problems and hassles I mentioned before:

  • A proof of concept that events can be handled
    • Running a COM server with PyWin32
    • A client, which written in VBA, is executing a function in the server
    • The server should trigger an event
    • The COM client should confirm that an event has been received
    • (Example: Can be a simple ping-pong test. In our case, we run a ping function and receive pong as text within an event.)
  • Using IDL files it should be easy to program clients in VisualStudio. For example, PyWin32 has also a mechanism to parse this info and generate dummies, so you can get suggestions in your Python IDE. Maybe this mechanism is something that is worth to take a look into. As you can see in Cura.idl I tried already tried to write such a file but was overwhelmed with that since I have no experiences with these files.
  • All needed patches on cx_Freeze and PyWin32 need to be shared as pull requests on GitHub and need to be merged by the maintainers to ensure long-time support.
  • Documentation of which changes have been done and how to create a fully featured COM server with PyWin32.

Are you interested? – Then register!

Just write me a mail or use the contact form to apply for this project. The tip will be transferred via SEPA transfer or PayPal. Any other method of transferring money or the usage of cryptocurrencies, like BitCoin, are not going to be used.

Additonally, if you need some further info, I own a book “Inside Distributed COM“. Personally I find the book promissing to deliever the needed info, but I’m not really motivated to crawl through about 530 pages to find the solution there. If you are interested and live close North Rhine-Westphalia, Germany, ask for it in the mail and I can borrow you this one.


[1] – https://docs.microsoft.com/en-us/windows/desktop/com/anatomy-of-an-idl-file