summaryrefslogtreecommitdiff
path: root/examples/client/python/file-transfer.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/client/python/file-transfer.py')
-rwxr-xr-xexamples/client/python/file-transfer.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/client/python/file-transfer.py b/examples/client/python/file-transfer.py
index f56fa1831..7dab55304 100755
--- a/examples/client/python/file-transfer.py
+++ b/examples/client/python/file-transfer.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+from __future__ import print_function
import sys
import os
import mimetypes
@@ -13,21 +14,21 @@ gi.require_version('TelepathyGLib', '0.12')
from gi.repository import TelepathyGLib
def usage():
- print "%s ACCOUNT CONTACT FILE" % sys.argv[0]
- print "ACCOUNT is a Telepathy account name, use 'mc-tool list' to list all your accounts"
- print "CONTACT is a contact id such as badger@nyan.cat"
- print "FILE is a path to the local file you want sent"
+ print("%s ACCOUNT CONTACT FILE" % sys.argv[0])
+ print("ACCOUNT is a Telepathy account name, use 'mc-tool list' to list all your accounts")
+ print("CONTACT is a contact id such as badger@nyan.cat")
+ print("FILE is a path to the local file you want sent")
sys.exit(1)
def provide_file_cb(channel, result, data):
if not channel.provide_file_finish(result):
- print 'failed to provide'
+ print('failed to provide')
def state_changed_cb(channel, pspec, data):
main_loop, file_path = data
state, _ = channel.get_state()
- print 'state is now', state
+ print('state is now', state)
if state == TelepathyGLib.FileTransferState.ACCEPTED:
file = Gio.File.new_for_path(file_path)
@@ -38,8 +39,8 @@ def create_channel_cb(request, result, data):
(chan, context) = request.create_and_handle_channel_finish(result)
chan.connect('notify::state', state_changed_cb, data)
- except GObject.GError, e:
- print "Failed to create channel: %s" % e
+ except GObject.GError as e:
+ print("Failed to create channel: %s" % e)
sys.exit(1)
if __name__ == '__main__':