[PD] Python socket to PD

enrike enrike at altern.org
Wed Aug 11 13:42:10 CEST 2004


Hi

you could use the OSC implementation for python by daniel holth (or 
write your own if you are into doing stuff yourself). I am not sure 
about the URL for the latest version but i could send it to you if you 
want. Its just few ks.
Its basically what you are trying to do but its already done and it 
follows the OSC protocol. This means that you could use it to comunicate 
to many other programs that understand OSC such as MAX, Supercolider 
etc... with the same python script.

But you need to install the OSC external for pd

Alternatively we have created a very simple interface to this 
implementation for non experienced users and students on top of Daniels 
implmentation. It makes it very straight forward to use. Its reduced to 
very basic commands so you dont have to deal with sockets and so on . 
Again i could post this as well if you are interested.

b


joseph moore wrote:

> Hello list,
> How should one go about sending information (in this case text) from 
> Python to PD.  I know about the Python objects for PD but I want to have 
> the Python script be able to run outside PD and with with a wxPython 
> GUI.  So, right now I'm just trying to send a simple text message from 
> Python to PD.  I have a netreceive connected to port 50007 and am 
> running the following Python:
> 
> import sys
> from socket import *
> serverHost = 'localhost'
> serverPort = 50007
> 
> message = ['hello PD']
> if len(sys.argv) > 1:
>     serverHost = sys.argv[1]
>     if len(sys.argv) > 2:
>             message = sys.argv[2:]
> 
> sockobj = socket(AF_INET, SOCK_STREAM)
> sockobj.connect((serverHost, serverPort))
> 
> for line in message:
>     sockobj.send(line)
>     data = sockobj.recv(1024)
>     print 'Client received', data
> sockobj.close()
> 
> This is a little OT but I would appreciate help none the less ; )
> 
> best,
> Joe(mediocre Python programmer trying to get better)
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's 
> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> 
> _______________________________________________
> PD-list mailing list
> PD-list at iem.at
> to manage your subscription (including un-subscription) see
> http://iem.at/cgi-bin/mailman/listinfo/pd-list
> 


-- 
enrike





More information about the Pd-list mailing list