[PD] Pd+pachube+python

FernandoG dataferx at gmail.com
Mon Dec 6 02:26:37 CET 2010


Hi
I am trying to comunicate pd with data coming from pachube (www.pachube.com)
using a python script. The script ask for data from pachube web and convert
the data to OSC protocol. Then the OSC mesagge is sent to pd. Pd recibe the
OSC mesagge but something is wrong when unpack and route the data.
Data can not get in a number box object, this error mesagge is diplayed in
console:   error: gatom: no method for '1'

The python script

# to receive data
import urllib2
# to send on with OpenSoundControl, OSC
from simpleOSC import *
import time


initOSCClient('127.0.0.1', 57110)
while 1:
  data=urllib2.urlopen('
http://api.pachube.com/v2/feeds/2791.csv?key=hereyourcode')
  for l in data:
    d = l.strip().split(",", 2)
    print d
    sendOSCMsg('/test/num',d[0])
    sendOSCMsg('/test/val',d[2])
    time.sleep(5) # wait here some secs


the patch

#N canvas 599 0 450 476 10;
#X declare -lib mrpeach;
#X obj -217 25 import mrpeach;
#X obj -220 112 unpackOSC;
#X floatatom -219 277 5 0 0 0 - - -;
#X obj -214 148 routeOSC /test;
#X obj -191 348 print;
#X floatatom -150 281 5 0 0 0 - - -;
#X obj -219 66 udpreceive 57110;
#X floatatom -92 290 5 0 0 0 - - -;
#X obj -204 205 routeOSC /val /num;
#X connect 1 0 3 0;
#X connect 3 0 8 0;
#X connect 6 0 1 0;
#X connect 8 0 2 0;
#X connect 8 1 5 0;
#X connect 8 1 4 0;
#X connect 8 2 7 0;


any idea?

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20101205/ffaf1171/attachment.htm>


More information about the Pd-list mailing list