trouble with import odbc
Steve Holden
sholden at holdenweb.com
Tue Dec 11 08:14:35 EST 2001
More information about the Python-list mailing list
Tue Dec 11 08:14:35 EST 2001
- Previous message (by thread): trouble with import odbc
- Next message (by thread): trouble with import odbc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<wryder at taz.cs.wcupa.edu> wrote in message news:9v3aj4$9ke$1 at news.netmar.com... > > Anyone ever seen this error given the code after that: > > File "odbc.py", line 1, in ? > import dbi, odbc, sys > File "odbc.py", line 4, in ? > s = odbc('postgresql/postgres/n4pk1n') > TypeError: object of type 'module' is not callable > ----------------- > import dbi, odbc > > s = odbc('postgresql/postgres/n4pk1n') > cur = s.cursor() > cur.execute('select * from discounts') > print cur.description > for tup in cur.description: > print tup[0], print > while 1: > rec = cur.fetchmany(10) > if not rec: break > print rec > > > Finding it very hard to chase stuff like this down. What the heck does that > error message mean? Maybe some nutrinos caused two bits on my hardrive to > swap so that the module is corrupt and isn't callable? Whatever. Anyway, > Thanks in advance! wryder at taz.cs.wcupa.edu > First you have to go into the ODBC settings (Start Menu | Settings | Control Panel, double click on ODBC) and create a System DSN pointing to the database you want to use. This will require you to have a PostgreSQL ODBC driver loaded, whcih I assume you've done. Then you should call conn = odbc.odbc("DSNName") to make the connection to your database. The error message is an exact description of what you are doing wrong. You would get the same thing if you wrote import sys sys("Hello") regards Steve -- http://www.holdenweb.com/
- Previous message (by thread): trouble with import odbc
- Next message (by thread): trouble with import odbc
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list