On 6 Dec 2010, at 01:26, FernandoG <[email protected]> wrote:

> 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. 

It looks like someone is solving the same problem in Max. Maybe worth a look...

http://www.frankmacdonald.co.uk/digital-economy-news/parsing-pachube-xml-data-directly-into-maxmsp-updated-version.html

Jamie


> 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
> _______________________________________________
> [email protected] mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to