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/
Hi,
GrIPD does exactly this, and the source is available. http://crca.ucsd.edu/~jsarlo/gripd
Joe jsarlo@ucsd.edu
----- Original Message ----- From: "joseph moore" joseph_moore_@hotmail.com To: pd-list@iem.at Sent: Tuesday, August 10, 2004 1:48 PM Subject: [PD] Python socket to PD
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@iem.at to manage your subscription (including un-subscription) see http://iem.at/cgi-bin/mailman/listinfo/pd-list
message = ['hello PD']
try message = ['hello PD;\n']
Pall
On þri, 2004-08-10 at 20:48, 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@iem.at to manage your subscription (including un-subscription) see http://iem.at/cgi-bin/mailman/listinfo/pd-list
Hallo, Pall Thayer hat gesagt: // Pall Thayer wrote:
message = ['hello PD']
try message = ['hello PD;\n']
The ";" is the important part, the newline will get appended by socket.socket().send itself.
And attached is my little Python->Pd commandline app.
Frank Barknecht _ ______footils.org__
hi,
the attachment contains a python <-> pd connection model. Extract the archive, open "net.pd" and follow the instructions within the patch.
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@iem.at to manage your subscription (including un-subscription) see http://iem.at/cgi-bin/mailman/listinfo/pd-list