[Twisted-Python] Question : Combining wokel XMPP and twisted.internet.serial
bino oetomo
bino at indoakses-online.com
Thu Dec 22 23:09:32 EST 2011
Dear Jean-Paul
Thankyou for your help.
On 12/23/2011 09:57 AM, exarkun at twistedmatrix.com wrote:
>
> A SerialPort doesn't have a transport. It is a transport. Instead of:
>
> self.serial.transport.write(foo)
>
> try
>
> self.serial.write(foo)
>
Here is my function (edited)
-------START-------
def onMessage(self, msg):
#Will just print the msg body to stdout
self.writethis = msg.body
print '<<<<>>>>>>>\n'
print self.writethis
print '\n<<<<>>>>>>>\n'
# Send something to serial port
#self.serial.transport.write('some message\n')
self.serial.write(self.writethis)
----------------------
the "print self.writethis" do as told
but the "self.serial.write(self.writethis)" line raise an exceptions
----------START-------------
File "./mytac01.tac", line 44, in onMessage
self.serial.write(self.writethis)
File
"/usr/lib/python2.6/dist-packages/twisted/internet/abstract.py", line
191, in write
self._tempDataLen += len(data)
exceptions.TypeError: object of type 'Element' has no len()
--------------------------
Sincerely
-bino-
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
More information about the Twisted-Python
mailing list