diff decoupage/cli.py @ 107:450aff4c97e3

py35 compat
author Jeff Hammel <k0scist@gmail.com>
date Fri, 31 Mar 2017 17:06:59 -0700
parents c382bdd01751
children
line wrap: on
line diff
--- a/decoupage/cli.py	Fri Mar 31 16:38:02 2017 -0700
+++ b/decoupage/cli.py	Fri Mar 31 17:06:59 2017 -0700
@@ -19,6 +19,7 @@
 
 here = os.path.dirname(os.path.realpath(__file__))
 
+
 class DecoupageServer(Decoupage):
     """serve locally with decoupage"""
     # TODO: deprecate; move Decoupage to a few classes
@@ -81,17 +82,18 @@
     # TODO: allow choice amongst server classes
     printable_address = '127.0.0.1' if options.address == '0.0.0.0' else options.address
     server = simple_server.make_server(options.address, options.port, app)
-    print 'serving directory %s ( %s ) at \nhttp://%s:%d/' % (directory,
-                                                              'file://' + directory, # XXX
-                                                              printable_address,
-                                                              options.port)
+    print("""serving directory {directory} ( file://{directory} ) at
+http://{hostname}:{port}/'""".format(directory=directory,
+                                     hostname=printable_address,
+                                     port=options.port))
+
     if options.print_ip:
         # from http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib
         hostname = "google.com"
         s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         s.connect((hostname,80))
         hostname = s.getsockname()[0]
-        print "http://%s:%s/" % (hostname, options.port)
+        print ("http://{hostname}:{port}/".format(hostname=hostname, port=options.port))
         s.close()
 
     # serve directory contents via decoupage
@@ -100,5 +102,6 @@
     except KeyboardInterrupt:
         pass
 
+
 if __name__ == '__main__':
     main()