nicer error message when running on python < 3.3 or python 2

This commit is contained in:
jacob1 2017-04-22 17:31:16 -04:00
parent 3f9f06613a
commit 9f43a8a6d6

View File

@ -23,8 +23,10 @@ import os
import botconfig import botconfig
if sys.version_info < (3, 3): ver = sys.version_info
if ver < (3, 3):
print("Python 3.3 or newer is required to run the bot.") print("Python 3.3 or newer is required to run the bot.")
print("You are currently using {0}.{1}.{2}".format(ver[0], ver[1], ver[2]))
sys.exit(1) sys.exit(1)
try: # need to manually add dependencies here try: # need to manually add dependencies here
@ -34,14 +36,14 @@ except ImportError:
command = "python3" command = "python3"
if os.name == "nt": if os.name == "nt":
command = "py -3" command = "py -3"
print("*** Missing dependencies! ***".center(80), print("\n".join(["*** Missing dependencies! ***".center(80),
"Please install the missing dependencies by running the following command:", "Please install the missing dependencies by running the following command:",
"{0} -m pip install --user -r requirements.txt".format(command), "", "{0} -m pip install --user -r requirements.txt".format(command), "",
"If you don't have pip and don't know how to install it, follow this link:", "If you don't have pip and don't know how to install it, follow this link:",
"https://pip.pypa.io/en/stable/installing/", "", "https://pip.pypa.io/en/stable/installing/", "",
"If you need any further help with setting up and/or running the bot,", "If you need any further help with setting up and/or running the bot,",
" we will be happy to help you in #lykos on irc.freenode.net", "", " we will be happy to help you in #lykos on irc.freenode.net", "",
"- The lykos developers", sep="\n") "- The lykos developers"]))
sys.exit(1) sys.exit(1)
from oyoyo.client import IRCClient from oyoyo.client import IRCClient