From 1c96d8c933aaf8770b83a228d22936e36e40da3d Mon Sep 17 00:00:00 2001 From: Jonas Lundholm Bertelsen Date: Mon, 24 Jul 2017 12:25:21 +0200 Subject: [PATCH] Correct import of socketserver on Python 3 --- pelican/tools/templates/fabfile.py.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pelican/tools/templates/fabfile.py.in b/pelican/tools/templates/fabfile.py.in index 18131d5f..d3c50a83 100644 --- a/pelican/tools/templates/fabfile.py.in +++ b/pelican/tools/templates/fabfile.py.in @@ -3,7 +3,10 @@ import fabric.contrib.project as project import os import shutil import sys -import SocketServer +try: + import socketserver +except ImportError: + import SocketServer as socketserver from pelican.server import ComplexHTTPRequestHandler @@ -48,7 +51,7 @@ def serve(): """Serve site at http://localhost:8000/""" os.chdir(env.deploy_path) - class AddressReuseTCPServer(SocketServer.TCPServer): + class AddressReuseTCPServer(socketserver.TCPServer): allow_reuse_address = True server = AddressReuseTCPServer(('', PORT), ComplexHTTPRequestHandler)