From 86cfed0ec5cb05486d239e65f59d834c10649c22 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 18 Mar 2022 14:25:19 +0000 Subject: [PATCH] Monitor: Add 'are you running this correctly?' check --- src/eddn/Monitor.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/eddn/Monitor.py b/src/eddn/Monitor.py index 3f1286c..f654d07 100644 --- a/src/eddn/Monitor.py +++ b/src/eddn/Monitor.py @@ -5,10 +5,30 @@ import argparse import collections import datetime import logging +import sys import zlib from threading import Thread from typing import OrderedDict +if sys.path[0].endswith('/eddn'): + print(sys.path) + print( + ''' +You're not running this script correctly. + +Do not do: + + python /Monitor.py + +instead do: + + cd + python -m eddn.Monitor +''' + ) + sys.exit(-1) + + import gevent import mysql.connector as mariadb import simplejson @@ -19,6 +39,7 @@ from zmq import SUB as ZMQ_SUB from zmq import SUBSCRIBE as ZMQ_SUBSCRIBE from eddn.conf.Settings import Settings, load_config +from eddn.core.EDDNWSGIHandler import EDDNWSGIHandler monkey.patch_all() @@ -41,14 +62,12 @@ if Settings.RELAY_DUPLICATE_MAX_MINUTES: duplicate_messages = DuplicateMessages() duplicate_messages.start() -from eddn.core.EDDNWSGIHandler import EDDNWSGIHandler - def parse_cl_args(): """Parse command-line arguments.""" parser = argparse.ArgumentParser( - prog="Gateway", - description="EDDN Gateway server", + prog="Monitor", + description="EDDN Monitor server", ) parser.add_argument(