Просмотр исходного кода

specify core/main.py as an absolute path, so we don't have to run 'python earwigbot.py' from within earwigbot/, but we can also do 'python /path/to/earwigbot.py'

tags/v0.1^2
Ben Kurtovic 13 лет назад
Родитель
Сommit
db0b125897
1 измененных файлов: 5 добавлений и 2 удалений
  1. +5
    -2
      earwigbot.py

+ 5
- 2
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:


Загрузка…
Отмена
Сохранить