[python-win32] check if comserver is registered, no -> install it?

Steffen Frömer steffen.froemer at gns-systems.de
Mon Dec 17 14:30:41 CET 2012


Quoting Tim Roberts <timr at probo.com>:

>
> There is no danger in redoing a registration that has already been
> done.  All it does is add some registry keys.  Might as well just do it
> every time.  Add "/s" if you don't want to see the dialog box.
>
> Alternatively, assuming you are running a 64-bit Python, you can just
> call the registration entry point directly:
>     import ctypes
>     dll = ctypes.OleDLL('myComServer.dll')
>     dll.DllRegisterServer()
>
> That's exactly what Regsvr32 does.  It is not a highly sophisticated
> application.

Hi i tried to do exactly this. But on executing the line

dll = ctypes.OleDLL('myComServer.dll')

i get following error:

Traceback (most recent call last):
   File "C:\Temp\com_tests.py", line 21, in <module>
     x = ctypes.OleDLL(os.path.realpath(local_dll))
   File "C:\Python32_x86_64\lib\ctypes\__init__.py", line 353, in __init__
     self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 ist keine zulässige Win32-Anwendung

what's the problem?

Regards, Steffen

Python 3.2.3 (default, Apr 11 2012, 07:12:16) [MSC v.1500 64 bit  
(AMD64)] on win32


More information about the python-win32 mailing list