[mod] same for error function
This commit is contained in:
parent
4747366446
commit
24b9883f02
@ -8,6 +8,7 @@ import shutil
|
|||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
from .cache import CACHE
|
from .cache import CACHE
|
||||||
|
from .utils import error
|
||||||
|
|
||||||
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
|
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
|
||||||
index_template = templates.get_template("index.html")
|
index_template = templates.get_template("index.html")
|
||||||
@ -83,16 +84,6 @@ class Image(object):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
def error(test, error_message):
|
|
||||||
if test:
|
|
||||||
return
|
|
||||||
|
|
||||||
sys.stderr.write(error_message)
|
|
||||||
sys.stderr.write("\n")
|
|
||||||
sys.stderr.write("Abort.\n")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if os.system("which gm > /dev/null") != 0:
|
if os.system("which gm > /dev/null") != 0:
|
||||||
sys.stderr.write("ERROR: I can't locate the 'gm' binary, I won't be able to resize images, please install the 'graphicsmagick' package.\n")
|
sys.stderr.write("ERROR: I can't locate the 'gm' binary, I won't be able to resize images, please install the 'graphicsmagick' package.\n")
|
||||||
|
11
prosopopee/utils.py
Normal file
11
prosopopee/utils.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def error(test, error_message):
|
||||||
|
if test:
|
||||||
|
return
|
||||||
|
|
||||||
|
sys.stderr.write(error_message)
|
||||||
|
sys.stderr.write("\n")
|
||||||
|
sys.stderr.write("Abort.\n")
|
||||||
|
sys.exit(1)
|
Loading…
x
Reference in New Issue
Block a user