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

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Import a module by specified module path

        def import_module(module_path):
    """Import a module by specified module path"""
    savestdout, savestderr = sys.stdout, sys.stderr
    sys.stdout, sys.stderr = [UselessStd()] * 2
    try:
        if sys.platform.startswith('java'):
            import java
            while True:
                try:
                    module = __import__(module_path)
                except java.lang.ExceptionInInitializerError:
                    continue
                else:
                    break
        else:
            module = __import__(module_path)
    finally:
        sys.stdout, sys.stderr = savestdout, savestderr
    # For Jython: Raise error if imported module is a Java class
    if repr(module).startswith("
    


src/p/y/pylibtracer-0.9.1/pylibtracer/libtracer.py   pylibtracer(Download)
        # Import module by `module_path`
        try:
            module = utils.import_module(module_path)
        except:
            return
        # Include full package
        if package_name not in self.__full_packages:
            package = utils.import_module(package_name)
            try:
                root, ext = utils.splitext(package.__file__)
                continue
 
            module = utils.import_module(module_path)
            try:
                module_filename = module.__file__
        # Get all available filenames under a package
        for package_name in self.__full_packages:
            module = utils.import_module(package_name)
            package_dir = os.path.dirname(module.__file__)
            # For Jython: Fix path if starts with `__pyclasspath__`