clach04  committed 4062d8a Draft

Quick change to make readline optional (e.g. under Windows or Jython) and tarfile (not present with Jython 2.2).

  • Participants
  • Parent commits 977b1b6
  • Branches default

Comments (0)

Files changed (1)

 import sys, os, errno, socket, getopt, commands, tempfile
 import cgi, urllib, urlparse, BaseHTTPServer
-import readline
+    import readline
+except ImportError:
+    readline = None
 import ConfigParser
-import shutil, tarfile, zipfile
+import shutil, zipfile
+    import tarfile
+except ImportError:
+    tarfile=None
 import struct
 maxdownloads = 1
       fname = urllib.unquote (fname)
       fname = os.path.basename (fname)
-   readline.set_startup_hook (lambda: readline.insert_text (fname))
+   if readline:
+      readline.set_startup_hook (lambda: readline.insert_text (fname))
    fname = raw_input ("Enter target filename: ")
-   readline.set_startup_hook (None)
+   if readline:
+      readline.set_startup_hook (None)
    override = False