def init_env(project='default', set_syspath=True):
 cfg = get_config()
 if cfg.has_option('settings', project):
  os.environ['SCRAPY_SETTINGS_MODULE'] = cfg.get('settings', project)
 closest = closest_scrapy_cfg()
 if closest:
  projdir = os.path.dirname(closest)
  if (set_syspath and (projdir not in sys.path)):
   sys.path.append(projdir)

def init_env ( project = 'default' , set_syspath = True ) : cfg = get_config ( ) if cfg . has_option ( 'settings' , project ) : os . environ [ 'SCRAPY_SETTINGS_MODULE' ] = cfg . get ( 'settings' , project ) closest = closest_scrapy_cfg ( ) if closest : projdir = os . path . dirname ( closest ) if ( set_syspath and ( projdir not in sys . path ) ) : sys . path . append ( projdir )
initialize environment to use command-line tool from inside a project dir .