summaryrefslogtreecommitdiff
path: root/examples/client/python/text-handler.py
diff options
context:
space:
mode:
authorArusekk <arek_koz@o2.pl>2020-10-26 23:05:26 +0100
committerAlexandr Akulich <akulichalexander@gmail.com>2023-09-04 21:01:51 +0000
commitaeffd07ed6ac3ac320f159ee6e1ca30629f320bc (patch)
treeed9b34493f64e159ab67a490bfd025a34be40fb5 /examples/client/python/text-handler.py
parentaa858698d7ede76b3b4c825ca14b8061c24f14e1 (diff)
Port examples to python 3, retaining compatibility
Diffstat (limited to 'examples/client/python/text-handler.py')
-rwxr-xr-xexamples/client/python/text-handler.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/client/python/text-handler.py b/examples/client/python/text-handler.py
index 7a1d6e87b..a0b33a440 100755
--- a/examples/client/python/text-handler.py
+++ b/examples/client/python/text-handler.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+from __future__ import print_function
import gi
from gi.repository import GObject
@@ -12,9 +13,9 @@ def echo_message(channel, msg, pending):
text, flags = msg.to_text()
if pending:
- print "pending: %s" % (text)
+ print("pending: %s" % (text))
else:
- print "received: %s" % (text)
+ print("received: %s" % (text))
reply = TelepathyGLib.ClientMessage.new_text(
TelepathyGLib.ChannelTextMessageType.NORMAL, text.upper())
@@ -42,7 +43,7 @@ def handle_channels_cb(handler, account, connection, channels, requests,
if not isinstance(channel, TelepathyGLib.TextChannel):
continue
- print "Handling text channel with", channel.get_identifier()
+ print("Handling text channel with", channel.get_identifier())
channel.connect('message-received', message_received_cb)