[Fwd: Bug#143159: python-pygresql: pygresql raises the wrong exception type] - Mailing list pgsql-interfaces

From Oliver Elphick
Subject [Fwd: Bug#143159: python-pygresql: pygresql raises the wrong exception type]
Date
Msg-id 1018989327.32076.23.camel@linda
Whole thread Raw
List pgsql-interfaces
Debian bug report on 7.2.1 PygreSQL.  Could any Python guru comment,
please?

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

From: dman <dman@dman.ddts.net>
To: Debian Bug Tracking System <submit@bugs.debian.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
connectionson 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.Elphick@lfix.co.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  

pgsql-interfaces by date:

Previous
From: pgmail@pgexplorer.com (Hano de la Rouviere)
Date:
Subject: Re: What is the best GUI tool for PostgreSQL
Next
From: Fernando Carvalho
Date:
Subject: My is degraded after two weeks