Blame | Last modification | View Log | RSS feed
import osimport subprocessfrom datastore.DataAccessor import DataHelperimport sys"""Documentation for script runmobstore.pyThis is the script called by consetup.pyFirst it will run the spider for mobilestore dynamically (i.e for determining no of pages)Then, it will generate the csv file@param path to the folder in which spider-projects reside (:/home/gaurav/code) but start with pathsep"""ps = os.pathsepds = os.seppath = sys.argv[1]path0 = path[1:len(path)]+ds+"ScrapyDatastore"+ds+"src"path1 = path+ds+"ExtraFunctions"+ds+"src"path2 = path+ds+"filterforname"+ds+"src"path3 = path0+path1+path2os.environ['PYTHONPATH'] = path3path3 = str(os.getenv("PYTHONPATH"))path4 = path + ds+"mobilestoreScrapy0"+ds+"src"path3 = path3 + path4os.putenv("PYTHONPATH",path3)path4 = path4.replace(ps,"")path4 = path4 + ds+"scrapy-ctl.py"da = DataHelper()da.initxy()#da = DataHelper()ct = 800da.set_extra_vars('mobilestore_count',str(ct),'')da.set_extra_vars('mobilestore_fails','0','')da.set_extra_vars('mobilestore_flag','TRUE','')flag = da.get_extra_vars('mobilestore_flag')print flagwhile flag=='TRUE':subprocess.call(["python", path4, "crawl", "mobilestore0"])ct = ct+50da.set_extra_vars('mobilestore_count',str(ct),'')flag = da.get_extra_vars('mobilestore_flag')