Пример #1
0
 def test_ECPW_DATATYPE(self):
     """ Is ECPW_DATATYPE corect? """
     ecs = ecpw.Store()
     self.assertTrue(ecs.ECPW_DATATYPE == "ECPW")
     self.assertTrue(ecs.ECPW_VERSION == "0.1")
Пример #2
0
 def test_init_w_empty_input(self):
     """ Is the __init__() working as expected? """
     ecs = ecpw.Store()
     self.assertTrue(ecs._filen == os.path.expanduser("~")+"/.ecpw")
     self.assertTrue(ecs._crypt == None)
     self.assertTrue(isinstance(ecs._base, dict))
Пример #3
0
import os
import sys

import psycopg2

import ecpw  # The EC-password module (local copy)
ecs = ecpw.Store()
db_ip, db_name, db_pw = ecs.gets('PostgreSQL_mh', ['ip', 'name', 'password'])

try:
    connection = psycopg2.connect(user=db_name,
                                  password=db_pw,
                                  host=db_ip,
                                  port="5432",
                                  database="geoint")
    cursor = connection.cursor()
    # Print PostgreSQL Connection properties
    print("WHOAMI: {}".format(connection.get_dsn_parameters()))
    # Print PostgreSQL version
    cursor.execute("SELECT version();")
    record = cursor.fetchone()
    print("You are connected to - ", record, "\n")
except (Exception, psycopg2.Error) as error:
    print("Error while connecting to PostgreSQL", error)
    sys.exit(999)

root_dir = r"../data/eci/"  # 3/

cnt_good, cnt_total = 0, 0
lst_k = list()
for r, d, f in os.walk(root_dir):