import sys
import psycopg2
import os
import yaml

if 'CATMAID_CONFIGURATION' in os.environ:
    path = os.environ['CATMAID_CONFIGURATION']
else:
    path = os.path.join(os.environ['HOME'], '.catmaid-db')

try:
    conf = yaml.load(open(path))
except:
    print >> sys.stderr, '''Your %s file should look like:

host: localhost
database: catmaid
username: catmaid_user
password: password_of_your_catmaid_user''' % (path,)
    sys.exit(1)

db_connection = psycopg2.connect(host=conf['host'],
                                 database=conf['database'],
                                 user=conf['username'],
                                 password=conf['password'])

import sys
import psycopg2
import os
import yaml

if 'CATMAID_CONFIGURATION' in os.environ:
    path = os.environ['CATMAID_CONFIGURATION']
else:
    path = os.path.join(os.environ['HOME'], '.catmaid-db')

try:
    conf = yaml.load(open(path))
except:
    print >> sys.stderr, '''Your %s file should look like:

host: localhost
database: catmaid
username: catmaid_user
password: password_of_your_catmaid_user''' % (path,)
    sys.exit(1)

# Make a variable for each of these so that they can be imported:
db_host = conf['host']
db_database = conf['database']
db_username = conf['username']
db_password = conf['password']

db_connection = psycopg2.connect(host=db_host,
                                 database=db_database,
                                 user=db_username,
                                 password=db_password)

Define variables for the DB name, host, etc. so they can be imported
Define variables for the DB name, host, etc. so they can be imported
