From a868ce2196299ef9037a53d09d24f64244955e47 Mon Sep 17 00:00:00 2001 From: GodSaveTheDoge <51802433+GodSaveTheDoge@users.noreply.github.com> Date: Thu, 10 Feb 2022 15:54:29 +0100 Subject: [PATCH] Fixed typo n stuff --- star/__init__.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/star/__init__.py b/star/__init__.py index be287f0..777af57 100644 --- a/star/__init__.py +++ b/star/__init__.py @@ -8,21 +8,23 @@ import sys import os -mods = [ - [ - f.split(".", 1)[0] - for f in os.listdir(spath) - if f.endswith(".py") - or ( - os.path.isdir(f) - and os.path.exists(os.path.join(f, "__init__.p__init__.py")) - ) - ] +__all__ = [ + f.split(".", 1)[0] + for spath in sys.path if os.path.exists(spath) + + for f in os.listdir(spath) + if f.endswith(".py") + or ( + os.path.isdir(os.path.join(spath,f)) + and os.path.exists(os.path.join(os.path.join(spath, f), "__init__.py")) + ) ] -__all__ = [f for m in mods for f in m] __path__ = [] def __getattr__(name): - return __import__(name) + try: + return __import__(name) + except Exception as e: + return e