def get_config(): ''' Read the config.json file ''' jsonfile = join(getProjectRoot(), 'config.json') with open(jsonfile) as f: try: config = json.load(f) except json.JSONDecodeError as err: raise json.JSONDecodeError( "Error reading '{0}' (line {2} col {3}): \n{1}".format( jsonfile, err.msg, err.lineno, err.colno), err.doc, err.pos) from err return config
def getFile(*relpath): r''' Converts the relative path of a database file in a the full path. Used by processing script not to worry about where the database is stored Examples of use:: radis.db.getFile('CN','CN_Violet_vib.dat') radis.db.getFile('CN\CN_Violet_vib.dat') radis.db.getFile('CN\\CN_Violet_vib.dat') ''' # return os.path.join(os.path.dirname(__file__), *relpath) from radis.misc.utils import getProjectRoot return os.path.join(getProjectRoot(), 'db', *relpath)