puzzling AttributeError

jim.vickroy jim.vickroy at noaa.gov
Tue May 8 14:57:01 EDT 2001


Hello,

I have code that generates an AttributeError that I am unable to track
down because it "appears" to move as I zero in on it.

Here is the hopefully relevant code fragment that illustrates the
problem; key statements are tagged as ### [ij] ###.


import sec.sxi.config
import sec.sxi.fits_product
import sec.sxi.product
import sec.sxi.relational_store
import sec.sxi.relational_store_map
import sec.sxi.txt_product
import generic.rdb
import generic.sql



class _base:
   """
   Places information from and about product files in a relational
store.
   """


   def __init__ (self, resources):
      """
      Creates an RDb agent to load product file data into a target
      specified in the *resources* parameter.
      """

      self._tracer_queue   = resources ['tracer messages queue']
      self._target      = resources ['RDb target']

      self._mapping = sec.sxi.relational_store_map.get_from
(sec.sxi.config.rdb_layout) ### [01] ###
         # database layout mapped to products




class ngdc (_base):
   """
   Places product data in the NGDC relational store.
   """


   def __init__ (self, resources):
      """
      Configures an instance to use the NGDC relational store as the
target.
      """

      base_resources = {}
      base_resources ['tracer messages queue'] = resources ['tracer
messages queue']
      import sec.sxi.relational_store ### [02] ###
      configuration = sec.sxi.relational_store.configuration ['ngdc']
### [03] ###
      base_resources ['RDb target'] = generic.rdb.instance
(configuration)

      _base.__init__ (self, base_resources)


If statement ### [02] ### is omitted, an "AttributeError: sxi" exception
is raised at statement ### [03] ###.  If statement ### [02] ### is
added, the "AttributeError: sxi" exception occurs at statement ### [01]
###.

I have run (admittedly incomplete) unit tests for each of the imported
modules and this problem does not appear.

Any suggestions on how to locate this problem would be greatly
appreciated.

I'm running Python 2.0 on a Win 2k computer.

Thanks for your time.




More information about the Python-list mailing list