Fw: Re: [Zope] startup error

Michael Long mlong at datalong.com
Thu Aug 14 17:12:31 EDT 2003


I didn't know that was logic :)

Now I am really confused. What part of the "try...except...else" logic
is failing to get the error message. 

CODE SNIPPET:

  try:
    # Try to use custom storage
      m=imp.find_module('custom_zodb',[getConfiguration().instancehome])
  except:
    # if there is no custom_zodb,use the config file specified         
    # databases
      configuration = getConfiguration()
      DB = configuration.dbtab.getDatabase('/', is_root=1)
      Globals.BobobaseName = DB.getName()
  else:
      m=imp.load_module('Zope.custom_zodb', m[0], m[1], m[2])
      if hasattr(m,'DB'):
          DB=m.DB
      else:
          storage = m.Storage
          DB = ZODB.DB(storage)

RESULTING ERROR MESSAGE:

Traceback (most recent call last):
 File "/opt/zope/lib/python/Zope/App/startup.py", line 52, in startup
   m=imp.find_module('custom_zodb',[INSTANCE_HOME])
ImportError: No module named custom_zodb


> Michael Long wrote at 2003-8-13 18:27 -0400:
>  > > Isn't there a "try: ... except: " around this?
>  > 
>  > It is actually a "try: ... except: ... else: " which I don't think
is valid.
> 
> Why not?
> 
> The "else:" clause is executed when there is no exception.
> 
> With the "try: ... except:", you should not see exceptions from "...".
> 
> 
> Dieter
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 
> 









More information about the Zope mailing list