def read_template(tmplf):
 if pkg_resources.resource_exists('roscreate', tmplf):
  f = pkg_resources.resource_stream('roscreate', tmplf)
  t = f.read()
 else:
  r = rospkg.RosPack()
  with open(os.path.join(r.get_path('roscreate'), 'templates', tmplf)) as f:
   t = f.read()
 try:
  t = t.decode('utf-8')
 except AttributeError:
  pass
 return t

def read_template ( tmplf ) : if pkg_resources . resource_exists ( 'roscreate' , tmplf ) : f = pkg_resources . resource_stream ( 'roscreate' , tmplf ) t = f . read ( ) else : r = rospkg . RosPack ( ) with open ( os . path . join ( r . get_path ( 'roscreate' ) , 'templates' , tmplf ) ) as f : t = f . read ( ) try : t = t . decode ( 'utf-8' ) except AttributeError : pass return t
read resource template from egg installation .