From 5d5a94c9e59fcc66c19ed05cc495f2b30cc9e7c2 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Fri, 29 Apr 2022 18:16:37 +0200 Subject: [PATCH] Bugfix start as program --- cps.py | 13 ++++++------- cps/__init__.py | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cps.py b/cps.py index 91bb1d74..e4f9c520 100755 --- a/cps.py +++ b/cps.py @@ -20,16 +20,15 @@ import os import sys -# Are we running from commandline? -if __package__ == '': - # Add local path to sys.path so we can import cps - path = os.path.dirname(os.path.dirname(__file__)) - sys.path.insert(0, path) -from cps.main import main as _main +# Add local path to sys.path so we can import cps +path = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, path) + +from cps.main import main if __name__ == '__main__': - _main() + main() diff --git a/cps/__init__.py b/cps/__init__.py index 3f92571b..1ba1f778 100644 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -19,6 +19,8 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +__package__ = "cps" + import sys import os import mimetypes