[Fwd: Bug#143159: python-pygresql: pygresql raises the wrong exception type]

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: [Fwd: Bug#143159: python-pygresql: pygresql raises the wrong exception type]
Date: 2002-04-16 20:35:26
Message-ID: 1018989327.32076.23.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Debian bug report on 7.2.1 PygreSQL. Could any Python guru comment,
please?

-----Forwarded Message-----

From: dman <dman(at)dman(dot)ddts(dot)net>
To: Debian Bug Tracking System <submit(at)bugs(dot)debian(dot)org>
Subject: Bug#143159: python-pygresql: pygresql raises the wrong exception type
Date: 16 Apr 2002 11:41:05 -0500

Package: python-pygresql
Version: 7.2.1-2
Severity: normal

I have just discovered that pygresql raises the wrong exception type
in some circumstances. All exceptions are supposed to be a subclass
of pgdb.Error. If postmaster is not running on the host, this example
shows that pygresql raises an exception whose type is '_pg.error' (a
string).

~~~~
#!/usr/bin/python2.1

import sys
import pgdb

try :
conn = pgdb.connect( host="localhost" )
except pgdb.Error :
print "Correct"
except :
print "Wrong!"
print type( sys.exc_info()[0] )
sys.stdout.write( sys.exc_info()[1] )
~~~~

~~~~
Wrong!
<type 'string'>
could not connect to server: Connection refused
Is the server running on host localhost and accepting
TCP/IP connections on port 5432?
~~~~

-D

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux dman 2.4.18-custom.3 #1 Mon Apr 15 09:54:59 CDT 2002 i686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8

Versions of packages python-pygresql depends on:
ii libc6 2.2.5-4 GNU C Library: Shared libraries an
ii libpgsql2 7.2.1-2 Shared library libpq.so.2 for Post
ii python 2.1.2-3 An interactive object-oriented scr
ii python2.1-egenix-mxdatetime 2.0.3-3 Date and time handling routines fo

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C

"But seek ye first the kingdom of God, and his
righteousness; and all these things shall be added
unto you." Matthew 6:33

Browse pgsql-interfaces by date

  From Date Subject
Next Message Fernando Carvalho 2002-04-17 11:09:17 My is degraded after two weeks
Previous Message Hano de la Rouviere 2002-04-16 07:51:40 Re: What is the best GUI tool for PostgreSQL