diff --git a/deluge/main.py b/deluge/main.py index add84bf9e..bf98601fe 100644 --- a/deluge/main.py +++ b/deluge/main.py @@ -39,6 +39,7 @@ # user runs the command 'deluge'. """Main starting point for Deluge. Contains the main() entry point.""" +from __future__ import print_function import os import sys @@ -53,10 +54,10 @@ import deluge.configmanager def version_callback(option, opt_str, value, parser): - print os.path.basename(sys.argv[0]) + ": " + deluge.common.get_version() + print(os.path.basename(sys.argv[0]) + ": " + deluge.common.get_version()) try: from deluge._libtorrent import lt - print "libtorrent: %s" % lt.version + print("libtorrent: %s" % lt.version) except ImportError: pass raise SystemExit @@ -123,7 +124,7 @@ def start_ui(): config = deluge.configmanager.ConfigManager("ui.conf") config["default_ui"] = options.default_ui config.save() - print "The default UI has been changed to", options.default_ui + print("The default UI has been changed to", options.default_ui) sys.exit(0) version = deluge.common.get_version() @@ -187,7 +188,7 @@ this should be an IP address", metavar="IFACE", if options.config: if not deluge.configmanager.set_config_dir(options.config): - print "There was an error setting the config directory! Exiting..." + print("There was an error setting the config directory! Exiting...") sys.exit(1) # Check for any daemons running with this same config @@ -196,8 +197,8 @@ this should be an IP address", metavar="IFACE", try: check_running_daemon(pid_file) except deluge.error.DaemonRunningError: - print "You cannot run multiple daemons with the same config directory set." - print "If you believe this is an error, you can force a start by deleting: %s" % pid_file + print("You cannot run multiple daemons with the same config directory set.") + print("If you believe this is an error, you can force a start by deleting: %s" % pid_file) sys.exit(1) # Setup the logger @@ -209,7 +210,7 @@ this should be an IP address", metavar="IFACE", os.makedirs(os.path.abspath(os.path.dirname(options.logfile))) except OSError as ex: if ex.errno != EEXIST: - print "There was an error creating the log directory, exiting... (%s)" % ex + print("There was an error creating the log directory, exiting... (%s)" % ex) sys.exit(1) logfile_mode = 'w' @@ -272,11 +273,11 @@ this should be an IP address", metavar="IFACE", # Twisted catches signals to terminate def save_profile_stats(): profiler.dump_stats(profile_output) - print "Profile stats saved to %s" % profile_output + print("Profile stats saved to %s" % profile_output) from twisted.internet import reactor reactor.addSystemEventTrigger("before", "shutdown", save_profile_stats) - print "Running with profiler..." + print("Running with profiler...") profiler.runcall(run_daemon, options) else: run_daemon(options) diff --git a/deluge/plugins/Label/deluge/plugins/label/test.py b/deluge/plugins/Label/deluge/plugins/label/test.py index 50a8b3180..ddd3dd437 100644 --- a/deluge/plugins/Label/deluge/plugins/label/test.py +++ b/deluge/plugins/Label/deluge/plugins/label/test.py @@ -1,3 +1,4 @@ +from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # @@ -35,7 +36,7 @@ from deluge.ui.client import sclient sclient.set_core_uri() -print sclient.get_enabled_plugins() +print(sclient.get_enabled_plugins()) #enable plugin. if not "label" in sclient.get_enabled_plugins(): @@ -43,27 +44,27 @@ if not "label" in sclient.get_enabled_plugins(): #test labels. -print "#init labels" +print("#init labels") try: sclient.label_remove("test") except: pass id = sclient.get_session_state()[0] -print "#add" +print("#add") sclient.label_add("test") -print "#set" +print("#set") sclient.label_set_torrent(id,"test") -print sclient.get_torrents_status({"label":"test"},"name") +print(sclient.get_torrents_status({"label":"test"},"name")) -print "#set options" +print("#set options") sclient.label_set_options("test",{"max_download_speed":999}, True) -print sclient.get_torrent_status(id, ["max_download_speed"]) , "999" +print(sclient.get_torrent_status(id, ["max_download_speed"]) , "999") sclient.label_set_options("test",{"max_download_speed":9}, True) -print sclient.get_torrent_status(id, ["max_download_speed"]) , "9" +print(sclient.get_torrent_status(id, ["max_download_speed"]) , "9") sclient.label_set_options("test",{"max_download_speed":888}, False) -print sclient.get_torrent_status(id, ["max_download_speed"]) , "9 (888)" +print(sclient.get_torrent_status(id, ["max_download_speed"]) , "9 (888)") -print sclient.get_torrent_status(id,['name', 'tracker_host', 'label']) +print(sclient.get_torrent_status(id,['name', 'tracker_host', 'label'])) diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py index 5ad16d202..82ab1dcc2 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py @@ -657,7 +657,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): if response == gtk.RESPONSE_OK: new_filename = dialog.get_filename() dialog.destroy() - print new_filename + log.debug(new_filename) model.set(iter, SND_PATH, new_filename, SND_NAME, basename(new_filename)) diff --git a/deluge/plugins/Stats/deluge/plugins/stats/test.py b/deluge/plugins/Stats/deluge/plugins/stats/test.py index 373e97032..1528305c8 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/test.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/test.py @@ -1,3 +1,4 @@ +from __future__ import print_function from deluge.ui.client import sclient, aclient sclient.set_core_uri() import graph @@ -7,8 +8,8 @@ def test_sync(): if 1: upload = sclient.graph_get_upload() download = sclient.graph_get_download() - print upload - print download + print(upload) + print(download) else: upload = [66804, 66915, 66974, 67447, 67540, 67318, 67320, 67249, 66659, 66489, 67027, 66914, 66802, 67303, 67654, 67643, 67763, 67528, 67523, 67431, 67214, 66939, 67316, 67020, 66881, 67103, 67377, 67141, 67366, 67492, 67375, 67203, 67056, 67010, 67029, 66741, 66695, 66868, 66805, 66264, 66249, 66317, 66459, 66306, 66681, 66954, 66662, 66278, 65921, 65695, 65681, 65942, 66000, 66140, 66424, 66480, 66257, 66271, 66145, 65854, 65568, 65268, 65112, 65050, 65027, 64676, 64655, 64178, 64386, 63979, 63271, 62746, 62337, 62297, 62496, 62902, 63801, 64121, 62957, 62921, 63051, 62644, 63240, 64107, 63968, 63987, 63644, 63263, 63153, 62999, 62843, 62777, 63101, 63078, 63178, 63126, 63401, 62630, 62451, 62505, 62254, 61485, 61264, 60937, 60568, 61011, 61109, 60325, 60196, 59640, 59619, 59514, 60813, 60572, 61632, 61689, 63365, 64583, 66396, 67179, 68209, 68295, 67674, 67559, 67195, 66178, 65632, 66124, 66456, 66676, 67183, 67620, 66960, 66347, 65925, 65907, 65896, 66738, 66703, 67060, 67004, 67007, 66329, 65304, 52002, 38969, 25433, 12426, 0, 0] download = [42926, 43853, 43157, 45470, 44254, 46272, 45083, 47344, 46716, 51963, 50112, 52334, 55525, 57545, 53691, 51637, 49574, 49836, 48295, 49843, 52878, 56014, 56966, 56938, 60065, 60461, 56542, 59526, 58678, 54424, 51862, 55109, 52132, 53783, 51687, 56567, 52182, 50758, 46714, 50511, 48161, 50920, 48694, 50528, 55074, 55420, 55882, 59268, 59958, 57938, 57115, 51424, 51180, 53184, 52879, 51177, 54417, 51097, 47901, 49870, 55865, 61118, 61476, 63498, 58878, 49630, 45975, 45632, 45892, 44855, 49495, 48304, 45829, 42152, 39403, 37574, 32384, 34933, 34901, 33492, 31953, 36271, 33826, 34515, 36408, 41106, 43054, 44110, 40810, 41383, 37267, 35881, 38660, 37525, 34857, 36718, 36842, 34281, 39528, 41854, 42952, 40021, 41722, 41045, 42917, 39287, 38672, 32824, 28765, 22686, 18490, 15714, 15268, 14793, 15305, 16354, 16720, 17502, 17857, 16622, 18447, 19929, 31138, 36965, 36158, 32795, 30445, 21997, 18100, 22491, 27227, 29317, 32436, 35700, 39140, 36258, 33697, 24751, 20354, 8211, 3836, 1560, 834, 2034, 1744, 1637, 1637, 1637, 0, 0] diff --git a/deluge/plugins/Stats/deluge/plugins/stats/test_total.py b/deluge/plugins/Stats/deluge/plugins/stats/test_total.py index ff64877ca..18c3af0ba 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/test_total.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/test_total.py @@ -1,20 +1,21 @@ +from __future__ import print_function from deluge.ui.client import sclient, aclient from deluge.common import fsize sclient.set_core_uri() def print_totals(totals): for name, value in totals.iteritems(): - print name , fsize(value) + print(name , fsize(value)) - print "overhead:" - print "up:", fsize(totals["total_upload"] - totals["total_payload_upload"] ) - print "down:", fsize(totals["total_download"] - totals["total_payload_download"] ) + print("overhead:") + print("up:", fsize(totals["total_upload"] - totals["total_payload_upload"] )) + print("down:", fsize(totals["total_download"] - totals["total_payload_download"] )) -print "==totals==" +print("==totals==") print_totals(sclient.stats_get_totals()) -print "==session totals==" +print("==session totals==") print_totals(sclient.stats_get_session_totals()) diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index ef89894e0..f578407e2 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -6,6 +6,7 @@ example: python create_plugin.py --name MyPlugin2 --basepath . --author-name "Your Name" --author-email "yourname@example.com" """ +from __future__ import print_function from datetime import datetime from optparse import OptionParser @@ -27,23 +28,23 @@ parser.add_option("-c", "--config", dest="configdir", help="location of deluge c def create_plugin(): if not options.name: - print "--name is mandatory , use -h for more info" + print("--name is mandatory , use -h for more info") return if not options.path: - print "--basepath is mandatory , use -h for more info" + print("--basepath is mandatory , use -h for more info") return if not options.author_email: - print "--author-email is mandatory , use -h for more info" + print("--author-email is mandatory , use -h for more info") return if not options.author_email: - print "--author-name is mandatory , use -h for more info" + print("--author-name is mandatory , use -h for more info") return if not options.url: options.url = "" if not os.path.exists(options.path): - print "basepath does not exist" + print("basepath does not exist") return if not options.configdir: @@ -64,7 +65,7 @@ def create_plugin(): python_path = sys.executable if os.path.exists(plugin_base): - print "the directory %s already exists, delete it first" % plugin_base + print("the directory %s already exists, delete it first" % plugin_base) return def write_file(path, filename, template, include_gpl=True): @@ -88,14 +89,14 @@ def create_plugin(): f.write(template % args) f.close() - print "creating folders.." + print("creating folders..") os.mkdir(plugin_base) os.mkdir(deluge_namespace) os.mkdir(plugins_namespace) os.mkdir(src) os.mkdir(data_dir) - print "creating files.." + print("creating files..") write_file(plugin_base,"setup.py", SETUP) write_file(deluge_namespace, "__init__.py", NAMESPACE_INIT, False) write_file(plugins_namespace, "__init__.py", NAMESPACE_INIT, False) @@ -108,7 +109,7 @@ def create_plugin(): write_file(data_dir, "%s.js" % safe_name, DEFAULT_JS) #add an input parameter for this? - print "building dev-link.." + print("building dev-link..") write_file(plugin_base,"create_dev_link.sh", CREATE_DEV_LINK) dev_link_path = os.path.join(plugin_base, "create_dev_link.sh") os.system("chmod +x %s" % dev_link_path) #lazy.. diff --git a/deluge/scripts/wiki_docgen.py b/deluge/scripts/wiki_docgen.py index 73fa2ba71..6987b3a93 100644 --- a/deluge/scripts/wiki_docgen.py +++ b/deluge/scripts/wiki_docgen.py @@ -1,3 +1,4 @@ +from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # @@ -42,7 +43,7 @@ import pydoc import inspect import textwrap sclient.set_core_uri() -print "\n\n" +print("\n\n") if 0: #aclient non-core @@ -97,21 +98,21 @@ if 0: #plugin-manager print("%s" % pydoc.getdoc(func)) if 0: #possible config-values - print "=== config-values ===" + print("=== config-values ===") cfg = sclient.get_sconfig() for key in sorted(cfg.keys()): - print "%s:%s()" % (key, type(cfg[key]).__name__) + print("%s:%s()" % (key, type(cfg[key]).__name__)) if 0: #keys - print """== Notes == + print("""== Notes == * The available keys for get_torrent_status(id, keys) {{{ #!python ->>>sorted(sclient.get_status_keys())""" - print "\n".join(textwrap.wrap(str(sorted(sclient.get_status_keys())),100)) - print """}}}""" +>>>sorted(sclient.get_status_keys())""") + print("\n".join(textwrap.wrap(str(sorted(sclient.get_status_keys())),100))) + print("""}}}""") -print "\n\n" +print("\n\n") diff --git a/deluge/tests/test_plugin_metadata.py b/deluge/tests/test_plugin_metadata.py index 0dc346ddc..c24ef72ea 100644 --- a/deluge/tests/test_plugin_metadata.py +++ b/deluge/tests/test_plugin_metadata.py @@ -1,7 +1,8 @@ +from __future__ import print_function import deluge.pluginmanagerbase pm = deluge.pluginmanagerbase.PluginManagerBase("core.conf", "deluge.plugin.core") for p in pm.get_available_plugins(): - print "Plugin: %s" % (p) + print("Plugin: %s" % (p)) for k, v in pm.get_plugin_info(p).items(): - print "%s: %s" % (k, v) + print("%s: %s" % (k, v)) diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py index 2e7f11b7c..f029eaf08 100644 --- a/deluge/tests/test_torrent.py +++ b/deluge/tests/test_torrent.py @@ -1,3 +1,4 @@ +from __future__ import print_function from twisted.trial import unittest import os @@ -61,10 +62,10 @@ class TorrentTestCase(unittest.TestCase): tmp = '' for i, p in enumerate(priorities): if i % 100 == 0: - print tmp + print(tmp) tmp = '' tmp += "%s" % p - print tmp + print(tmp) def get_torrent_atp(self, filename): filename = os.path.join(os.path.dirname(__file__), filename) diff --git a/deluge/tests/test_transfer.py b/deluge/tests/test_transfer.py index 1b9ee2577..be9d3904b 100644 --- a/deluge/tests/test_transfer.py +++ b/deluge/tests/test_transfer.py @@ -1,3 +1,4 @@ +from __future__ import print_function # -*- coding: utf-8 -*- # # test_transfer.py @@ -78,11 +79,11 @@ class TransferTestClass(DelugeTransferProtocol): """ import zlib - print "\n=== New Data Received ===\nBytes received:", len(data) + print("\n=== New Data Received ===\nBytes received:", len(data)) if self._buffer: # We have some data from the last dataReceived() so lets prepend it - print "Current buffer:", len(self._buffer) if self._buffer else "0" + print("Current buffer:", len(self._buffer) if self._buffer else "0") data = self._buffer + data self._buffer = None @@ -90,10 +91,10 @@ class TransferTestClass(DelugeTransferProtocol): self._bytes_received += len(data) while data: - print "\n-- Handle packet data --" + print("\n-- Handle packet data --") - print "Bytes received:", self._bytes_received - print "Current data:", len(data) + print("Bytes received:", self._bytes_received) + print("Current data:", len(data)) if self._message_length == 0: # handle_new_message uses _buffer so set data to _buffer. @@ -102,21 +103,21 @@ class TransferTestClass(DelugeTransferProtocol): data = self._buffer self._buffer = None self.packet_count = 1 - print "New message of length:", self._message_length + print("New message of length:", self._message_length) dobj = zlib.decompressobj() try: request = rencode.loads(dobj.decompress(data)) - print "Successfully loaded message", - print " - Buffer length: %d, data length: %d, unused length: %d" % \ - (len(data), len(data) - len(dobj.unused_data), len(dobj.unused_data)) - print "Packet count:", self.packet_count + print("Successfully loaded message", end=' ') + print(" - Buffer length: %d, data length: %d, unused length: %d" % \ + (len(data), len(data) - len(dobj.unused_data), len(dobj.unused_data))) + print("Packet count:", self.packet_count) except Exception as ex: #log.debug("Received possible invalid message (%r): %s", data, e) # This could be cut-off data, so we'll save this in the buffer # and try to prepend it on the next dataReceived() self._buffer = data - print "Failed to load buffer (size %d): %s" % (len(self._buffer), str(ex)) + print("Failed to load buffer (size %d): %s" % (len(self._buffer), str(ex))) return else: data = dobj.unused_data @@ -258,15 +259,15 @@ class DelugeTransferProtocolTestCase(unittest.TestCase): three_messages_byte_count = two_messages_byte_count + \ len(base64.b64decode(self.msg1_expected_compressed_base64)) - print + print() - print "Msg1 size:", len(base64.b64decode(self.msg1_expected_compressed_base64)) - 4 - print "Msg2 size:", len(base64.b64decode(self.msg2_expected_compressed_base64)) - 4 - print "Msg3 size:", len(base64.b64decode(self.msg1_expected_compressed_base64)) - 4 + print("Msg1 size:", len(base64.b64decode(self.msg1_expected_compressed_base64)) - 4) + print("Msg2 size:", len(base64.b64decode(self.msg2_expected_compressed_base64)) - 4) + print("Msg3 size:", len(base64.b64decode(self.msg1_expected_compressed_base64)) - 4) - print "one_message_byte_count:", one_message_byte_count - print "two_messages_byte_count:", two_messages_byte_count - print "three_messages_byte_count:", three_messages_byte_count + print("one_message_byte_count:", one_message_byte_count) + print("two_messages_byte_count:", two_messages_byte_count) + print("three_messages_byte_count:", three_messages_byte_count) for d in self.receive_parts_helper(msg_bytes, packet_size, self.transfer.dataReceived_old_protocol): bytes_received = self.transfer.get_bytes_recv() @@ -281,8 +282,8 @@ class DelugeTransferProtocolTestCase(unittest.TestCase): expected_msgs_received_count = 0 # Verify that the expected number of complete messages has arrived if expected_msgs_received_count != len(self.transfer.get_messages_in()): - print "Expected number of messages received is %d, but %d have been received." % \ - (expected_msgs_received_count, len(self.transfer.get_messages_in())) + print("Expected number of messages received is %d, but %d have been received." % \ + (expected_msgs_received_count, len(self.transfer.get_messages_in()))) # Get the data as received by DelugeTransferProtocol message1 = self.transfer.get_messages_in().pop(0) diff --git a/deluge/ui/console/commander.py b/deluge/ui/console/commander.py index c08afa59a..676615ccd 100644 --- a/deluge/ui/console/commander.py +++ b/deluge/ui/console/commander.py @@ -1,3 +1,4 @@ +from __future__ import print_function # # commander.py # @@ -139,9 +140,9 @@ class Commander: else: rm = reason.getErrorMessage() if host: - print "Could not connect to daemon: %s:%s\n %s" % (host, port, rm) + print("Could not connect to daemon: %s:%s\n %s" % (host, port, rm)) else: - print "Could not connect to localhost daemon\n %s" % rm + print("Could not connect to localhost daemon\n %s" % rm) self.do_command("quit") if host: diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py index 17ef59510..e0aa9a8a0 100644 --- a/deluge/ui/console/main.py +++ b/deluge/ui/console/main.py @@ -1,3 +1,4 @@ +from __future__ import print_function # # main.py # @@ -190,7 +191,7 @@ class OptionParser(optparse.OptionParser): def exit(self, status=0, msg=None): self.values._exit = True if msg: - print msg + print(msg) def error(self, msg): """error(msg : string) @@ -317,7 +318,7 @@ class ConsoleUI(component.Component): args = ' '.join(args) self.interactive = False if not cmds: - print "Sorry, couldn't find any commands" + print("Sorry, couldn't find any commands") return else: from commander import Commander @@ -334,13 +335,13 @@ class ConsoleUI(component.Component): import curses.wrapper curses.wrapper(self.run) elif self.interactive and deluge.common.windows_check(): - print """\nDeluge-console does not run in interactive mode on Windows. \n + print("""\nDeluge-console does not run in interactive mode on Windows. \n Please use commands from the command line, eg:\n deluge-console.exe help deluge-console.exe info deluge-console.exe "add --help" deluge-console.exe "add -p c:\\mytorrents c:\\new.torrent" - """ + """) else: reactor.run() @@ -452,7 +453,7 @@ Please use commands from the command line, eg:\n component.get("LegacyUI").add_line(s, False) self.events.append(s) else: - print colors.strip_colors(s.encode(self.encoding)) + print(colors.strip_colors(s.encode(self.encoding))) def write_event(self, s): if self.interactive: @@ -463,4 +464,4 @@ Please use commands from the command line, eg:\n component.get("LegacyUI").add_line(s, False) self.events.append(s) else: - print colors.strip_colors(s.encode(self.encoding)) + print(colors.strip_colors(s.encode(self.encoding))) diff --git a/deluge/ui/gtkui/path_combo_chooser.py b/deluge/ui/gtkui/path_combo_chooser.py index 7dded1db5..a95f018fd 100755 --- a/deluge/ui/gtkui/path_combo_chooser.py +++ b/deluge/ui/gtkui/path_combo_chooser.py @@ -1,3 +1,4 @@ +from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # @@ -1560,7 +1561,7 @@ if __name__ == "__main__": entry2.set_filechooser_button_enabled(False) def list_value_added_event(widget, values): - print "Current list values:", widget.get_values() + print("Current list values:", widget.get_values()) entry1.connect("list-value-added", list_value_added_event) entry2.connect("list-value-added", list_value_added_event) diff --git a/deluge/ui/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py index d1ac62e8d..06540a253 100644 --- a/deluge/ui/gtkui/torrentview_data_funcs.py +++ b/deluge/ui/gtkui/torrentview_data_funcs.py @@ -1,3 +1,4 @@ +from __future__ import print_function # -*- coding: utf-8 -*- # torrentview_data_funcs.py # @@ -184,7 +185,7 @@ def cell_data_speed(cell, model, row, data, cache_key): try: speed = model.get_value(row, data) except AttributeError: - print "AttributeError" + print("AttributeError") import traceback traceback.print_exc() if func_last_value[cache_key] == speed: diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py index cb45d1720..492aea0e2 100644 --- a/deluge/ui/ui.py +++ b/deluge/ui/ui.py @@ -1,3 +1,4 @@ +from __future__ import print_function # # ui.py # @@ -49,10 +50,10 @@ except ImportError: def version_callback(option, opt_str, value, parser): - print os.path.basename(sys.argv[0]) + ": " + deluge.common.get_version() + print(os.path.basename(sys.argv[0]) + ": " + deluge.common.get_version()) try: from deluge._libtorrent import lt - print "libtorrent: %s" % lt.version + print("libtorrent: %s" % lt.version) except ImportError: pass raise SystemExit diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py index 23c50bbcd..fecb722ea 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -1,3 +1,4 @@ +from __future__ import print_function # -*- coding: utf-8 -*- # # Copyright (C) 2009 Damien Churchill @@ -136,11 +137,11 @@ class Web(_UI): # Twisted catches signals to terminate def save_profile_stats(): profiler.dump_stats(profile_output) - print "Profile stats saved to %s" % profile_output + print("Profile stats saved to %s" % profile_output) from twisted.internet import reactor reactor.addSystemEventTrigger("before", "shutdown", save_profile_stats) - print "Running with profiler..." + print("Running with profiler...") profiler.runcall(run_server) else: run_server()