mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-25 20:37:48 +08:00
解决python 3.6不能相对导入问题
This commit is contained in:
+5
-7
@@ -22,9 +22,8 @@ class Collect(object):
|
||||
for module in modules:
|
||||
module_path = settings.module_dir.joinpath(module)
|
||||
for path in module_path.rglob('*.py'):
|
||||
# Classes to be imported
|
||||
import_module = ('modules.' + module, path.stem)
|
||||
self.modules.append(import_module)
|
||||
import_module = f'modules.{module}.{path.stem}'
|
||||
self.modules.append([import_module, path.stem])
|
||||
else:
|
||||
self.modules = settings.enable_partial_module
|
||||
|
||||
@@ -32,8 +31,8 @@ class Collect(object):
|
||||
"""
|
||||
Import do function
|
||||
"""
|
||||
for package, name in self.modules:
|
||||
import_object = importlib.import_module('.' + name, package)
|
||||
for module, name in self.modules:
|
||||
import_object = importlib.import_module(module)
|
||||
func = getattr(import_object, 'run')
|
||||
self.collect_funcs.append([func, name])
|
||||
|
||||
@@ -47,8 +46,7 @@ class Collect(object):
|
||||
|
||||
threads = []
|
||||
# Create subdomain collection threads
|
||||
for collect_func in self.collect_funcs:
|
||||
func_obj, func_name = collect_func
|
||||
for func_obj, func_name in self.collect_funcs:
|
||||
thread = threading.Thread(target=func_obj, name=func_name,
|
||||
args=(self.domain,), daemon=True)
|
||||
threads.append(thread)
|
||||
|
||||
Reference in New Issue
Block a user