From 4327eef475c58c1daf33d99bbc632ca0d38cbd36 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Wed, 26 Oct 2011 22:34:34 -0400 Subject: [PATCH] Provide a useful message if overviewer is doubleclicked. Works for both py2exe .exes as well as double clicking the overviewer.py file --- overviewer.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/overviewer.py b/overviewer.py index 9f58ed0..6992fdc 100755 --- a/overviewer.py +++ b/overviewer.py @@ -15,7 +15,25 @@ # You should have received a copy of the GNU General Public License along # with the Overviewer. If not, see . +import platform import sys + +if platform.system() == 'Windows': + try: + import ctypes + GetConsoleProcessList = ctypes.windll.kernel32.GetConsoleProcessList + num = GetConsoleProcessList(ctypes.byref(ctypes.c_int(0)), ctypes.c_int(1)) + if (num == 1): + print "The Overviewer is a console program. Please open a Windows command prompt" + print "first and run Overviewer from there. Further documentation is available at" + print "http://docs.overviewer.org/\n" + print "Press [Enter] to close this window." + raw_input() + sys.exit(1) + + except Exception: + pass + if not (sys.version_info[0] == 2 and sys.version_info[1] >= 6): print "Sorry, the Overviewer requires at least Python 2.6 to run" if sys.version_info[0] >= 3: @@ -29,7 +47,6 @@ import subprocess import multiprocessing import time import logging -import platform from overviewer_core import util logging.basicConfig(level=logging.INFO,format="%(asctime)s [%(levelname)s] %(message)s")