Skip to content

Commit b7870ed

Browse files
committed
Fix Startup Error when plugins dir missing
1 parent d570354 commit b7870ed

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Plugin/PluginManager.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
class PluginManager:
1717
def __init__(self):
1818
self.log = logging.getLogger("PluginManager")
19-
self.path_plugins = os.path.abspath(os.path.dirname(plugins.__file__))
19+
self.path_plugins = None
20+
if plugins.__file__:
21+
self.path_plugins = os.path.dirname(os.path.abspath(plugins.__file__));
2022
self.path_installed_plugins = config.data_dir + "/__plugins__"
2123
self.plugins = defaultdict(list) # Registered plugins (key: class name, value: list of plugins for class)
2224
self.subclass_order = {} # Record the load order of the plugins, to keep it after reload
@@ -32,7 +34,8 @@ def __init__(self):
3234

3335
self.config.setdefault("builtin", {})
3436

35-
sys.path.append(os.path.join(os.getcwd(), self.path_plugins))
37+
if self.path_plugins:
38+
sys.path.append(os.path.join(os.getcwd(), self.path_plugins))
3639
self.migratePlugins()
3740

3841
if config.debug: # Auto reload Plugins on file change
@@ -127,6 +130,8 @@ def listInstalledPlugins(self, list_disabled=False):
127130
def loadPlugins(self):
128131
all_loaded = True
129132
s = time.time()
133+
if self.path_plugins is None:
134+
return
130135
for plugin in self.listPlugins():
131136
self.log.debug("Loading plugin: %s (%s)" % (plugin["name"], plugin["source"]))
132137
if plugin["source"] != "builtin":

0 commit comments

Comments
 (0)