mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Add a try/catch arround plugin directory determination (might be useful for some utilities...)
This commit is contained in:
parent
cb0139299a
commit
db849e21a0
@ -74,7 +74,13 @@ def getPluginDir(plugin_name):
|
|||||||
except KeyError: # It sometimes happens with Owner
|
except KeyError: # It sometimes happens with Owner
|
||||||
pass
|
pass
|
||||||
if filename == None:
|
if filename == None:
|
||||||
|
try:
|
||||||
filename = sys.modules['supybot.plugins.' + plugin_name].__file__
|
filename = sys.modules['supybot.plugins.' + plugin_name].__file__
|
||||||
|
except: # In the case where the plugin is not loaded by Supybot
|
||||||
|
try:
|
||||||
|
filename = sys.modules['plugin'].__file__
|
||||||
|
except:
|
||||||
|
filename = sys.modules['__main__'].__file__
|
||||||
if filename.endswith(".pyc"):
|
if filename.endswith(".pyc"):
|
||||||
filename = filename[0:-1]
|
filename = filename[0:-1]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user