3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

conf: throw a specific error when PyYAML is missing

This commit is contained in:
James Lu 2016-07-19 17:45:43 -07:00
parent 3381dda884
commit fab61729b9
2 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,11 @@ This module is used to access the configuration of the current PyLink instance.
It provides simple checks for validating and loading YAML-format configurations from arbitrary files.
"""
import yaml
try:
import yaml
except ImportError:
raise ImportError("Please install PyYAML and try again.")
import sys
from collections import defaultdict

3
pylink
View File

@ -6,12 +6,13 @@ PyLink IRC Services launcher.
import os
import sys
try:
from pylinkirc import world, conf, __version__
from pylinkirc import world
except ImportError:
sys.stderr.write("ERROR: Failed to import PyLink main module (pylinkirc.world).\n\nIf you are "
"running PyLink from source, please install PyLink first using 'python3 "
"setup.py install [--user]'\n")
sys.exit(1)
from pylinkirc import conf, __version__
if __name__ == '__main__':
import argparse