From 624737d2e297b5b00d457d3dbcb3e523a7bfb508 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Wed, 3 Aug 2016 07:28:14 +0200 Subject: [PATCH 1/3] Fix for #45 DB_ROOT not found --- cps/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/config.py b/cps/config.py index 1cfddf9c..4ca5d0f7 100755 --- a/cps/config.py +++ b/cps/config.py @@ -6,7 +6,7 @@ import sys from configobj import ConfigObj -CONFIG_FILE= os.path.join(os.getcwd(), "config.ini") +CONFIG_FILE= os.path.join(os.path.dirname(os.path.realpath(__file__))+"\\..\\", "config.ini") CFG = ConfigObj(CONFIG_FILE) def CheckSection(sec): From 5a0faf9950dd8ddb8252d3817b825b443ee81a91 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Thu, 4 Aug 2016 09:29:16 +0200 Subject: [PATCH 2/3] Now working on linux, too --- cps/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/config.py b/cps/config.py index 4ca5d0f7..679a0427 100755 --- a/cps/config.py +++ b/cps/config.py @@ -6,7 +6,7 @@ import sys from configobj import ConfigObj -CONFIG_FILE= os.path.join(os.path.dirname(os.path.realpath(__file__))+"\\..\\", "config.ini") +CONFIG_FILE= os.path.join(os.path.dirname(os.path.realpath(__file__))+os.sep+".."+os.sep, "config.ini") CFG = ConfigObj(CONFIG_FILE) def CheckSection(sec): From 59136a9cc2480b8be77f0dacca86c934d8746b61 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Sun, 7 Aug 2016 10:32:45 +0200 Subject: [PATCH 3/3] Linux path problem solved (finally) --- cps/config.py | 3 +-- cps/db.py | 2 +- cps/helper.py | 4 ++-- cps/ub.py | 2 +- cps/web.py | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cps/config.py b/cps/config.py index 679a0427..1b30cc9a 100755 --- a/cps/config.py +++ b/cps/config.py @@ -5,8 +5,7 @@ import os import sys from configobj import ConfigObj - -CONFIG_FILE= os.path.join(os.path.dirname(os.path.realpath(__file__))+os.sep+".."+os.sep, "config.ini") +CONFIG_FILE= os.path.join(os.path.normpath(os.path.dirname(os.path.realpath(__file__))+os.sep+".."+os.sep), "config.ini") CFG = ConfigObj(CONFIG_FILE) def CheckSection(sec): diff --git a/cps/db.py b/cps/db.py index 2cebe7bf..eee0f919 100755 --- a/cps/db.py +++ b/cps/db.py @@ -5,7 +5,7 @@ from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import * import os -from cps import config +import config import re import ast diff --git a/cps/helper.py b/cps/helper.py index 4f8364a8..907cd136 100755 --- a/cps/helper.py +++ b/cps/helper.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from cps import db, ub -from cps import config +import db, ub +import config from flask import current_app as app import smtplib diff --git a/cps/ub.py b/cps/ub.py index 564e45b2..82bfe59f 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -5,7 +5,7 @@ from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import * import os -from cps import config +import config from werkzeug.security import generate_password_hash dbpath = os.path.join(config.APP_DB_ROOT, "app.db") diff --git a/cps/web.py b/cps/web.py index b21cc486..2061a98e 100755 --- a/cps/web.py +++ b/cps/web.py @@ -8,7 +8,7 @@ import sys import textwrap mimetypes.add_type('application/xhtml+xml','.xhtml') from flask import Flask, render_template, session, request, Response, redirect, url_for, send_from_directory, make_response, g, flash, abort -from cps import db, config, ub, helper +import db, config, ub, helper import os import errno from sqlalchemy.sql.expression import func