On 08:53 am, b...@indoakses-online.com wrote: >Dear All .. > >I'm trying to received json formated text using LineReceiver > >Here is my code >----START---- >class ArduinoReceiver(LineReceiver): > def __init__(self): > print 'INIT : ArduinoReceiver' > > def lineReceived(self, line): > line = line.strip() > print 'Received line = '+line > if 'Arduino' in line : > return > self.linedict=json.loads(line) > >----STOP----- >but I got error msg in the log as : >----START---- >2012-05-14 15:42:00+0700 [-] Received line = >'{"a_flw_fwd":12,"a_flw_rtr":5029,"a_rpm":519,"b_flw_fwd":23,"b_flw_rtr":8,"b_rpm":913}'
Read your log message. This is not a valid JSON string: '{"a_flw_fwd":12,"a_flw_rtr":5029,"a_rpm":519,"b_flw_fwd":23,"b_flw_rtr":8,"b_rpm":913}' Presumably your objective is to receive something like this instead: {"a_flw_fwd":12,"a_flw_rtr":5029,"a_rpm":519,"b_flw_fwd":23,"b_flw_rtr":8,"b_rpm":913} The problem is unrelated to Twisted or the console. The sender is sending the wrong data, or else your parsing of it is incorrect. Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python