use os.listdir

This commit is contained in:
j 2020-12-13 00:05:32 +01:00
parent 3357992dd7
commit 629c1de8d5

View file

@ -226,7 +226,11 @@ class Client(object):
def load_plugins(self, base=os.path.join(utils.basedir(), 'client.d')): def load_plugins(self, base=os.path.join(utils.basedir(), 'client.d')):
global parse_path, example_path, ignore_file, sync_extensions, encode global parse_path, example_path, ignore_file, sync_extensions, encode
base = os.path.expanduser(base) base = os.path.expanduser(base)
for path in sorted(glob('%s%s*.py' % (base, os.sep))): for name in sorted(os.listdir(base)):
if not name.endswith('.py'):
continue
path = os.path.join(base, name)
with open(path) as fp: with open(path) as fp:
module = imp.load_source(os.path.basename(path).split('.')[0], base, fp) module = imp.load_source(os.path.basename(path).split('.')[0], base, fp)
if hasattr(module, 'parse_path'): if hasattr(module, 'parse_path'):