Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
try to import a list of library names as strings

  liblist: e.g. ['wx', 'numpy']
  details: if libname is in g_mesglist, print message
return the number of failures (0=success)

        def num_import_failures(liblist=[], details=1, verb=1):
   """try to import a list of library names as strings

        liblist: e.g. ['wx', 'numpy']
        details: if libname is in g_mesglist, print message
      return the number of failures (0=success)"""

   # note python version
   pv = get_py_ver_float()

   if verb > 2: print '-- python version %s' % pv

   if pv < 2.5: # use 2.4 version (might fail)
      exec(import_find_test_24_def)
      imptest = import_find_test_24
   else:        # use 2.5 version
      exec(import_find_test_25_def)
      imptest = import_find_test_25

   if liblist: libs = liblist
   else:       libs = alllibs

   errs = 0
   for lib in libs:
      rlib = imptest(lib, details, verb)
      if not rlib: errs = errs + 1

   return errs
        


src/t/e/testkraut-HEAD/testkraut/external/afni/lib_afni1D.py   testkraut(Download)
import module_test_lib
g_testlibs = ['math', 'copy']
if module_test_lib.num_import_failures(g_testlibs): sys.exit(1)