def findObject(name):
 names = name.split('.')
 topLevelPackage = None
 moduleNames = names[:]
 while (not topLevelPackage):
  trialname = '.'.join(moduleNames)
  if (len(trialname) == 0):
   return (False, None)
  try:
   topLevelPackage = __import__(trialname)
  except ImportError:
   exc_info = sys.exc_info()
   if (len(traceback.extract_tb(exc_info[2])) > 1):
    try:
     del sys.modules[trialname]
    except KeyError:
     pass
    raise exc_info[0], exc_info[1], exc_info[2]
   moduleNames.pop()
 obj = topLevelPackage
 for n in names[1:]:
  try:
   obj = getattr(obj, n)
  except AttributeError:
   return (False, obj)
 return (True, obj)

def findObject ( name ) : names = name . split ( '.' ) topLevelPackage = None moduleNames = names [ : ] while ( not topLevelPackage ) : trialname = '.' . join ( moduleNames ) if ( len ( trialname ) == 0 ) : return ( False , None ) try : topLevelPackage = __import__ ( trialname ) except ImportError : exc_info = sys . exc_info ( ) if ( len ( traceback . extract_tb ( exc_info [ 2 ] ) ) > 1 ) : try : del sys . modules [ trialname ] except KeyError : pass raise exc_info [ 0 ] , exc_info [ 1 ] , exc_info [ 2 ] moduleNames . pop ( ) obj = topLevelPackage for n in names [ 1 : ] : try : obj = getattr ( obj , n ) except AttributeError : return ( False , obj ) return ( True , obj )
get a fully-named package .