diff --git a/earwigbot.py b/earwigbot.py index b18f1bc..5543221 100644 --- a/earwigbot.py +++ b/earwigbot.py @@ -4,7 +4,7 @@ """ EarwigBot -A thin wrapper for EarwigBot's main bot code, located in core/main.py. This +A thin wrapper for EarwigBot's main bot code, specified by bot_script. This wrapper will automatically restart the bot when it shuts down (from !restart, for example). It requests the bot's password at startup and reuses it every time the bot restarts internally, so you do not need to re-enter the password @@ -16,6 +16,7 @@ markdown format!) and the LICENSE for licensing information. from getpass import getpass from subprocess import Popen, PIPE +from os import path from sys import executable from time import sleep @@ -27,6 +28,8 @@ __license__ = "MIT License" __version__ = "0.1dev" __email__ = "ben.kurtovic@verizon.net" +bot_script = path.join(path.dirname(path.abspath(__file__)), "core", "main.py") + def main(): print "EarwigBot v{0}\n".format(__version__) @@ -37,7 +40,7 @@ def main(): key = None while 1: - bot = Popen([executable, 'core/main.py'], stdin=PIPE) + bot = Popen([executable, bot_script], stdin=PIPE) bot.communicate(key) # give the key to core.config.load() return_code = bot.wait() if return_code == 1: