def load_from_file(file_path, package_context=''):
 if VERBOSE:
  if package_context:
   print('Load spec from', file_path, ('into package [%s]' % package_context))
  else:
   print('Load spec from', file_path)
 file_name = os.path.basename(file_path)
 type_ = file_name[:(- len(EXT))]
 base_type_ = type_
 if package_context:
  while package_context.endswith(SEP):
   package_context = package_context[:(-1)]
  type_ = ('%s%s%s' % (package_context, SEP, type_))
 if (not roslib.names.is_legal_resource_name(type_)):
  raise MsgSpecException(('%s: [%s] is not a legal type name' % (file_path, type_)))
 f = open(file_path, 'r')
 try:
  text = f.read()
  return (type_, load_from_string(text, package_context, type_, base_type_))
 except MsgSpecException as e:
  raise MsgSpecException(('%s: %s' % (file_name, e)))
 finally:
  f.close()

def load_from_file ( file_path , package_context = '' ) : if VERBOSE : if package_context : print ( 'Load spec from' , file_path , ( 'into package [%s]' % package_context ) ) else : print ( 'Load spec from' , file_path ) file_name = os . path . basename ( file_path ) type_ = file_name [ : ( - len ( EXT ) ) ] base_type_ = type_ if package_context : while package_context . endswith ( SEP ) : package_context = package_context [ : ( - 1 ) ] type_ = ( '%s%s%s' % ( package_context , SEP , type_ ) ) if ( not roslib . names . is_legal_resource_name ( type_ ) ) : raise MsgSpecException ( ( '%s: [%s] is not a legal type name' % ( file_path , type_ ) ) ) f = open ( file_path , 'r' ) try : text = f . read ( ) return ( type_ , load_from_string ( text , package_context , type_ , base_type_ ) ) except MsgSpecException as e : raise MsgSpecException ( ( '%s: %s' % ( file_name , e ) ) ) finally : f . close ( )
load a python module from its absolute filesystem path .