[python-win32] A shameless COM question

Tim Roberts timr at probo.com
Wed Apr 2 00:07:01 CEST 2008


Marcus Low wrote:
> Hi,
>  
> I am aggressively trying to try and use python for my team's sub 
> commercial project. However we are using a com component and  i have the
> example given in C#. It looks very simple to use and elegent in C# but 
> i need to do the same in python (minus the GUI of course)
>  
> The C# example is : 
> http://www.internetnow.com.my/download/marcus/Csharp.txt
>  
> I have generated from makepy the file : 
> http://www.internetnow.com.my/download/marcus/from_genpy.txt
>   
> How do i even begin to use the same "event" notification in Pytonwin? 
> I have resorted to ask this shameless question given that
> my COM knowledge is kinda rusty and i could only go as far as  :
>  
>  SmtpMail = win32com.client.Dispatch("WeOnlyDo.wodSmtpServerCom.1")     
>  SmtpMail.Start()
>  win32gui.PumpMessages()

Please allow me to steer to conversation in a slightly different 
direction.  The code you posted shows using that COM component to create 
a very simple SMTP server.  There are MANY ways of solving that problem 
in Python without resorting to complicated external components.  If the 
problem you are trying to solve really is just the creation of an SMTP 
server, then forget about the COM component, and start searching for 
Pythonic solutions.  The Twisted module, for example, makes something 
like this almost trivial.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list