From db419e0bdd104f6d6c4a9c3d9bea9ce6c6882efb Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Wed, 16 Mar 2022 19:21:39 -0300 Subject: [PATCH] Try another way of appending the events module to sys.path Still not quite right. The IDE wants to remove the 'unused' import, and trying to append the sys.path able the 'import sepa_mm_bot' also makes the IDE unhappy. --- python-examples/bots/path_config.py | 5 +++++ python-examples/bots/sepa_mm_bot_ui.py | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 python-examples/bots/path_config.py diff --git a/python-examples/bots/path_config.py b/python-examples/bots/path_config.py new file mode 100644 index 0000000..a50fb4d --- /dev/null +++ b/python-examples/bots/path_config.py @@ -0,0 +1,5 @@ +import os +import sys + +DIR_PATH = os.path.dirname(os.path.abspath(__file__)) +sys.path.append(os.path.join(DIR_PATH, 'events')) diff --git a/python-examples/bots/sepa_mm_bot_ui.py b/python-examples/bots/sepa_mm_bot_ui.py index 0fffbdb..c2a3d89 100644 --- a/python-examples/bots/sepa_mm_bot_ui.py +++ b/python-examples/bots/sepa_mm_bot_ui.py @@ -1,16 +1,11 @@ import configparser -import sys import threading from decimal import * from pathlib import Path from tkinter import * -# Append the events pkg to the system path before importing the sepa_mm_bot. -# TODO Is there a better way to do this? -sys.path.append('events') - +import path_config import sepa_mm_bot - from events.event_dispatcher import EventDispatcher from events.trade_event import TradeEvent from logger import log