r7800 - pyrepl/trunk/pyrepl

[email protected] Fri, 10 Dec 2004 00:00:39 +0100 (MET)
Newsgroups gmane.comp.python.pyrepl.checkins
Message-ID <[email protected]>
Author: bob
Date: Fri Dec 10 00:00:39 2004
New Revision: 7800

Modified:
   pyrepl/trunk/pyrepl/pythoni
Log:
make it work w/o twisted installed



Modified: pyrepl/trunk/pyrepl/pythoni
==============================================================================
--- pyrepl/trunk/pyrepl/pythoni	(original)
+++ pyrepl/trunk/pyrepl/pythoni	Fri Dec 10 00:00:39 2004
@@ -1,4 +1,4 @@
-#!/usr/local/bin/python
+#!/usr/bin/env python
 
 #   Copyright 2000-2002 Michael Hudson [email protected]
 #
@@ -33,4 +33,12 @@
 # whizzy feature:  graft pyrepl support onto pdb
 #pdb.Pdb = cmdrepl.replize(pdb.Pdb, 1)
 
-main(use_pygame_console=('pg' in sys.argv))
+try:
+    import imp
+    imp.find_module("twisted")
+except ImportError:
+    interactmethod="interact"
+else:
+    interactmethod="twistedinteract"
+
+main(use_pygame_console=('pg' in sys.argv), interactmethod=interactmethod)