catch dbi.program-error ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Herbert Withun

    #1

    catch dbi.program-error ?

    I'm having difficulty catching dbi.program-error which occurs this way:

    import dbi, odbc
    [...]
    self.__cur.exec ute(sql)
    [color=blue][color=green][color=darkred]
    >>> dbi.program-error: [Sybase][ODBC Driver][Adaptive Server Anywhere]Table 'depfile' not found in EXEC[/color][/color][/color]

    but

    try:
    self.__cur.exec ute(sql)
    except dbi.program-error,e:
    print " caught "
    raise

    causes
    [color=blue][color=green][color=darkred]
    >>> except dbi.program-error, e:
    >>> AttributeError: 'module' object has no attribute 'program'[/color][/color][/color]


    What, in general, is the offender here? The hyphen in
    "dbi.progra m-error" or the dot?

  • Brian Herbert Withun

    #2
    Re: catch dbi.program-error ?

    try:
    self.__cur.exec ute(sql)
    except dbi.program-error,e:
    print " caught "
    raise


    should be changed to:

    try:
    self.__cur.exec ute(sql)
    except dbi.progError,e :
    print " caught "
    raise

    In my infinite googling I found some source code that showed the actual
    name of this exception class. I can't explain why it reports the
    exception as "dbi.progra m-error" when left unhandled...

    Comment

    • Brian Herbert Withun

      #3
      Re: catch dbi.program-error ?

      try:
      self.__cur.exec ute(sql)
      except dbi.program-error,e:
      print " caught "
      raise


      should be changed to:

      try:
      self.__cur.exec ute(sql)
      except dbi.progError,e :
      print " caught "
      raise

      In my infinite googling I found some source code that showed the actual
      name of this exception class. I can't explain why it reports the
      exception as "dbi.progra m-error" when left unhandled...

      Comment

      Working...