Initialize msg to avoid unbound locals.
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 885b5cd..fda7864 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -115,6 +115,7 @@
         if host: self.host = host
         if port: self.port = port
         self.passiveserver = 0
+        msg = "getaddrinfo returns an empty list"
         for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
             af, socktype, proto, canonname, sa = res
             try:
@@ -270,6 +271,7 @@
 
     def makeport(self):
         '''Create a new socket and send a PORT command for it.'''
+        msg = "getaddrinfo returns an empty list"
         for res in socket.getaddrinfo(None, 0, self.af, socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
             af, socktype, proto, canonname, sa = res
             try: