(project='default', set_syspath=True)
Initialize environment to use command-line tool from inside a project
    dir. This sets the Scrapy settings module and modifies the Python path to
    be able to locate the project module.
Initialize environment to use command-line tool from inside a project
    dir. This sets the Scrapy settings module and modifies the Python path to
    be able to locate the project module.
Initialize environment to use command - line tool from inside a project dir . This sets the Scrapy settings module and modifies the Python path to be able to locate the project module .
def init_env(project='default', set_syspath=True):
    """Initialize environment to use command-line tool from inside a project
    dir. This sets the Scrapy settings module and modifies the Python path to
    be able to locate the project module.
    """
    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 )