that the registration was successful. Then I tried to add reference to that
dll in .NET. But I can not find my server on the com tab of adding a
reference. I want to mention that I can run the server as a python script
and consume it from .net using late binding. Is there something I'm missing
or doing wrong? I would appreciate any help.
#hello.py
import pythoncom
import sys
class HelloWorld:
#pythoncom.frozen = 1
if hasattr(sys, 'importers'):
-reg-class-spec- = " -readonly-attrs- = ['noCalls']
def print "Hello" + " " * self.softspace + str(who)
return "Hello" + " " * self.softspace + str(who)
if win32com.server.register.UseCommandLine(HelloWorld)
else:
# start the server.
from win32com.server import localserver
localserver.serve('CDBA816B-E80F-4545-BB68-5A3270C92A74')
else:
import win32com.server.register
win32com.server.register.UseCommandLine(HelloWorld)
# setup.py
from distutils.core import setup
import py2exe
setup(com-server = ["hello"])
Thanks
using py2exe tool.
then I used regsvr32.exe to register the dll.I got a message that the
registration was successful. Then I tried to add reference to that dll
in .NET. But I can not find my server on the com tab of adding a reference.=
I want to mention that I can run the server as a python script and consume=
it from .net using late binding.
Is there something I'm missing or doing wrong? I would appreciate any h=
elp.<br><br>#hello.py<br><br>import pythoncom<br>import sys<br><br><br>clas=
s HelloWorld:<br>=A0=A0=A0 #pythoncom.frozen =3D 1<br>=A0=A0=A0 if hasattr(=
sys, 'importers'):<br>
=A0=A0=A0=A0=A0=A0=A0 -reg-class-spec- =3D "alls']<br>=A0=A0=A0 <br>=A0=A0=A0 def pace + str(who)<br><br>if .server.register.UseCommandLine(HelloWorld)<br>
=A0=A0=A0=A0=A0=A0=A0 else:<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # start th=
e server.<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 from win32com.server import =
localserver<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 localserver.serve('CDB=
A816B-E80F-4545-BB68-5A3270C92A74')<br>=A0=A0=A0 else:<br>=A0=A0=A0=A0=
=A0=A0=A0 import win32com.server.register<br>
=A0=A0=A0=A0=A0=A0=A0 win32com.server.register.UseCommandLine(HelloWorld) <=
br><br># setup.py<br>from distutils.core import setup<br>import py2exe<br>s=
etup(com-server =3D ["hello"])<br><br clear=3D"all">Thanks<br>
Re: python-win32 - using registered python com server dll from .NET by Michel Claveau on
2009-07-06T11:09:27+00:00
Hi!
It is normal. COM servers made with Python no have TLB.
dotNET, for read info on a COM server need TLB.
In the same way, dotNET cannot use dynamic COM server (like Python can do
and use it). Except: IronPython (the last beta version) & JScript.Net (the
old, no the recent "manageable" version) can use it.
IMO, it is a dotNET problem, and no a Python problem.
@+