How to write an API for a Python application?

2005-11-14 Thread Gary Kshepitzki



Hello
I would like to create an API for a piece of Python 
code. The API is for use by non Python code.
It should support interaction in both directions, 
both accessing functions on the API and the ability for the API to raise events 
on its clients. 
What is the best way to do that?
I though of doing it as a python COM server 
but I am not familiar with COM and I saw that implementing a COM server with 
events in python is not trivial.

Is there a better (or simpler) 
solution?What are the common ways for doing that?
 
Any answer would be greatly 
appreciated.
Regards
Gary
 
-- 
http://mail.python.org/mailman/listinfo/python-list

Sending an event from a python COM server to a VB COM client

2005-11-15 Thread Gary Kshepitzki
Hello
I am trying to send an event from a Python COM server to a VB (or VB.NET) 
COM client.
I am a newbie both in VB and in python.
Can anyone give me a simple (but complete) code example both of the Python 
server side and the VB client side for raising a single event.

Any answer would be highly appreciated.
Regards
Gary


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sending an event from a python COM server to a VB COM client

2005-11-16 Thread Gary Kshepitzki
Thank you Steve.
I have already went over that book, I didn't find there an example of 
sending events from a python server to a VB client (just direct function 
calls from the VB client to the Python server, which is trivial). And in any 
case, since I am a newbie both in VB and in Python, I am really looking for 
an example that will spell things out for me. There's a lot of 'wrapping' 
happening under the hood in this technology and I am kind of lost between 
what is done for me on each side and what I should explicitly do my self.
Thanks again for taking the time to answer.
Gary


"Stephen Prinster" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Gary Kshepitzki wrote:
>> Hello
>> I am trying to send an event from a Python COM server to a VB (or VB.NET)
>> COM client.
>> I am a newbie both in VB and in python.
>> Can anyone give me a simple (but complete) code example both of the 
>> Python
>> server side and the VB client side for raising a single event.
>>
>> Any answer would be highly appreciated.
>> Regards
>> Gary
>>
>>
>
> I suggest the book _Python Programming on Win32_ by Mark Hammond and
> Andy Robinson.  There is a chapter online and I believe it even includes
> the example you need.
>
> http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html
>
> Steve P. 


-- 
http://mail.python.org/mailman/listinfo/python-list


How to write an API for a Python application?

2005-11-16 Thread Gary Kshepitzki
Hello
I would like to create an API for a piece of Python code. The API is for use 
by non Python code.
It should support interaction in both directions, both accessing functions 
on the API and the ability for the API to raise events on its client.
What is the best way to do that?
I though of doing it as a python COM server but I am not familiar with COM 
and I saw that implementing a COM server with events in python is not 
trivial for me.
Is there a better (or simpler) solution?
What are the common ways for doing that?

Any answer would be highly appreciated.
Regards
Gary 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to write an API for a Python application?

2005-11-16 Thread Gary Kshepitzki
Thanks
Its an interesting solution but I need a more closely coupled solution,
with real time events, so the communication really has to be 2 ways, and not 
by polling.
Thanks for putting the time and though.
Gary


<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> While not sure of the behavior you are trying to achieve, XML-RPC comes
> to mind.  But it's based on HTTP protocol in which the client puts
> request to the server which has to respond. The server cannot initiate
> interactions.
> XML-RPC is both widely avalaible, and very easy to implement.
>
> NOTE: in order for the server to raise events in the client, the client
> needs only raise periodically a *need-anything-from-me* type of request
> which permits the server to return its request in response to the
> client. Naturally this solution makes superfluous calls takes some
> bandwidth, so it might not be appropriate in every circumstance.
> 


-- 
http://mail.python.org/mailman/listinfo/python-list