Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Python Error: Issues with 'config" being callable

$
0
0

I am following instructions from a book that goes through how to create SQL tables with PostgreSQL within Python.

import psycopg2import configdef CreateTables():    tablesql = ("""        CREATE TABLE stock (                            dt TIMESTAMP without time zone NOT NULL,                            high NUMERIC NOT NULL,                            low NUMERIC NOT NULL,                            open NUMERIC NOT NULL,                            close NUMERIC NOT NULL,                            volume NUMERIC NOT NULL,                            adj_close NUMERIC NOT NULL,                            CONSTRAINT "GOOG_pkey" PRIMARY KEY (dt)                           )"""    )    conn = None    try:        params = config()        conn = psycopg2.connect(**params)        cur = conn.cursor()        for table in tablesql:            cur.execute(table)        cur.close()        conn.commit()    except (Exception, psycopg2.DatabaseError) as error:        print(error)    finally:        if conn is not None:            conn.close()if __name__ == '__main__':    CreateTables()

When I execute the above code, Python tells me 'config' is not callable.

But when I do from config import config, I get ImportError: cannot import name 'config' from 'config'.

I tried uninstalling config then reinstalling it to version 0.5.0.post0 using pip install config.

What's going on? Any help would be great.

Thank you,Cindy


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>