diff --git a/omas/omas_mongo.py b/omas/omas_mongo.py index 68aee448..83a2d863 100644 --- a/omas/omas_mongo.py +++ b/omas/omas_mongo.py @@ -155,9 +155,9 @@ def get_mongo_credentials(server='', database='', collection=''): server = server.split('@')[-1] up = {'user': 'omas_test', 'pass': 'omas_test'} config = {} - filename = pathlib.Path.home() / '/.omas/mongo_credentials' - if os.path.exists(filename): - with open(filename) as f: + filepath = pathlib.Path.home() / '/.omas/mongo_credentials' + if filepath.exists(): + with open(filepath) as f: config = json.loads(f.read()) if 'default' in config: up = config['default'] diff --git a/omas/tests/failed_imports.py b/omas/tests/failed_imports.py index 270d516e..53fbf978 100644 --- a/omas/tests/failed_imports.py +++ b/omas/tests/failed_imports.py @@ -42,7 +42,8 @@ from botocore.exceptions import NoCredentialsError import boto3 - if not os.path.exists(os.environ.get('AWS_CONFIG_FILE', pathlib.Path.home() + '/.aws/config')): + aws_confi_path = pathlib.Path(os.environ.get('AWS_CONFIG_FILE', pathlib.Path.home() / '/.aws/config')) + if not aws_confi_path.exists(): raise RuntimeError('Missing AWS configuration file ~/.aws/config') failed_S3 = False except (ImportError, RuntimeError, NoCredentialsError) as _excp: