# Adopt COM-Server Wrapper from Python to Julia

**URL:** https://discourse.julialang.org/t/adopt-com-server-wrapper-from-python-to-julia/79853
**Category:** Jobs
**Tags:** com-server
**Created:** [April 22, 2022, 3:37pm UTC](https://discourse.julialang.org/t/adopt-com-server-wrapper-from-python-to-julia/79853 "2022-04-22T15:37:37Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [April 22, 2022, 9:18pm UTC](https://discourse.julialang.org/t/adopt-com-server-wrapper-from-python-to-julia/79853/2 "2022-04-22T21:18:45Z")

</div>

I was mostly curious to know more about this project, so I googled, and I suppose it could be done (but I will not), since I think everything you can to in Python (at least on Windows) can be done in Julia. I see most of the project is in C++ (but I don’t think that changes things), assuming it that first one:

> **[GitHub - mhammond/pywin32: Python for Windows (pywin32) Extensions](https://github.com/mhammond/pywin32)**
>
> Python for Windows (pywin32) Extensions. Contribute to mhammond/pywin32 development by creating an account on GitHub.

I do see the makepy.py file itself is rather small (at 455 lines): [https://github.com/mhammond/pywin32/blob/main/com/win32com/client/makepy.py](https://github.com/mhammond/pywin32/blob/main/com/win32com/client/makepy.py)

it’s a generator, so possibly it’s easiest to change that file (and keep it in Python would then be ok) to rather generate Julia code. Since the generated code, is now, in Python, there might be lots more you need to translate, or not, just use PyCall.jl, or maybe rather by now PythonCall.jl? I.e. generate Julia code that uses Python libraries, and thus Python also, was that what you wanted?

> **[COM Clients and Servers - Win32 apps](https://learn.microsoft.com/en-us/windows/win32/com/com-clients-and-servers)**
>
> A critical aspect of COM is how clients and servers interact.

> There are two main types of servers, in-process and out-of-process. In-process servers are implemented in a dynamic linked library (DLL), and out-of-process servers are implemented in an executable file (EXE). Out-of-process servers can reside either on the local computer or on a remote computer.

Before I comment on that, I think you’re not asking to make a Julia COM server (that answer would be a bit involved), just a client for it, which the code should generate for you.

I haven’t seen much Windows-specific Julia code. Julia itself is cross-platform, most to not call the Win32 API directly (I’ve however seen a project for doing that, of course then tying you to Windows, or Wine e.g. under Linux), such as for a Windows GUI. [ ~~I’ve not seen anything for COM yet in Julia.~~ EDIT: found your post below:

> [@Is there something like pywin32 in Julia?](https://discourse.julialang.org/t/is-there-something-like-pywin32-in-julia/37024/3):
>
> Here is my example to use PyCall to open and modify an existing Excel-file via a COM server: # Create COM server via Python Interface # first: install "pywin32" via conda: # using Conda; Conda.add("pywin32") using PyCall using XLSX pw = pyimport("win32com") pwc = pyimport("win32com.client") FN\_excel = raw"C:\tmp\MyTest.xlsx"; if ~isfile(FN\_excel) XLSX.writetable(FN\_excel) end xlApp = pwc.Dispatch("Excel.Application") xlApp.Visible = 1 if isfile(FN\_excel) workBook = xlApp.Workbooks.O…

Personally I would like most to use cross-platform libraries such as Qt or GTK, also supporting Windows, or whatever is a COM replacement, if there is anything such (is there, or only a Linux replacement, but no abstraction targeting that or Windows?). If you need/want COM, I guess you do, but I’m curious, can you tell me what for?

It might be nice to know the real (business) problem you want solved. Maybe there’s another way, and this is an XY problem.

Before finding what I believe is the right code (please confirm), I also found:

> **[makepy](https://pypi.org/project/makepy/)**
>
> makepy: Handsfree Python Module Programming

there the code is only 390 lines (if someone want to start translating, I guess a slightly older version): [https://github.com/SublimeText/Pywin32/blob/master/lib/x32/win32com/client/makepy.py](https://github.com/SublimeText/Pywin32/blob/master/lib/x32/win32com/client/makepy.py)

---

_[View the full topic](https://discourse.julialang.org/t/adopt-com-server-wrapper-from-python-to-julia/79853)._
