Give some more specific info if PyWin can't be imported when frozen in
authorRobin Dunn <robin@alldunn.com>
Wed, 11 Oct 2006 23:51:03 +0000 (23:51 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 11 Oct 2006 23:51:03 +0000 (23:51 +0000)
a py2exe exexcutable

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41959 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/wx/lib/activexwrapper.py

index 81cf8e6035257c2bef96422655d7d62c5ee04853..67d09d6fd114f44b24ffbf575d482a4b0066efd8 100644 (file)
@@ -21,7 +21,17 @@ try:
     import pywin.mfc.activex
     import win32com.client
 except ImportError:
-    raise ImportError( "ActiveXWrapper requires PythonWin.  Please install the win32all-xxx.exe package.")
+    import sys
+    if hasattr(sys, "frozen"):
+        import os, win32api
+        dllpath = os.path.join(win32api.GetSystemDirectory(), 'MFC71.DLL')
+        if sys.version[:3] >= '2.4' and not os.path.exists(dllpath):
+            message = "%s not found" % dllpath
+        else:
+            raise       # original error message
+    else:
+        message = "ActiveXWrapper requires PythonWin. Please install the PyWin32 package." 
+    raise ImportError(message) 
 
 ##from win32con import WS_TABSTOP, WS_VISIBLE
 WS_TABSTOP = 0x00010000