0001 # Test makepy - try and run it over every OCX in the windows system directory. 0002 0003 import sys 0004 import win32api 0005 import traceback 0006 import glob 0007 import os 0008 import string 0009 import traceback 0010 0011 import win32com.test.util 0012 from win32com.client import makepy, selecttlb 0013 import pythoncom 0014 import winerror 0015 0016 def TestBuildAll(verbose = 1): 0017 num = 0 0018 tlbInfos = selecttlb.EnumTlbs() 0019 for info in tlbInfos: 0020 if verbose: 0021 print "%s (%s)" % (info.desc, info.dll) 0022 try: 0023 makepy.GenerateFromTypeLibSpec(info) 0024 num += 1 0025 except pythoncom.com_error, details: 0026 # Ignore these 2 errors, as the are very common and can obscure 0027 # useful warnings. 0028 if details[0] not in [winerror.TYPE_E_CANTLOADLIBRARY, 0029 winerror.TYPE_E_LIBNOTREGISTERED]: 0030 print "** COM error on", info.desc 0031 print details 0032 except KeyboardInterrupt: 0033 print "Interrupted!" 0034 raise KeyboardInterrupt 0035 except: 0036 print "Failed:", info.desc 0037 traceback.print_exc() 0038 return num 0039 0040 def TestAll(verbose = 0): 0041 num = TestBuildAll(verbose) 0042 print "Generated and imported", num, "modules" 0043 win32com.test.util.CheckClean() 0044 0045 if __name__=='__main__': 0046 TestAll(1) 0047
Generated by PyXR 0.9.4