Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

import os
import sys
import subprocess
from mail import *

"""
Documentation for script test.py
This is the script which one has to run if he wish to run the software
First it will run the consetup.py, which in turn run the spiders for individual suppliers.
Then, the generated csv files would be mailed to administrators.
@param  path to the folder in which spider-projects reside (/home/gaurav/code)
"""

#pathsep = Separator between paths(for ubuntu ':')
#sep = Separator between directories in a path(for ubuntu '/')
path =  sys.argv[1]
ps = os.pathsep
ds = os.sep

#setting PYTHONPATH
path = ps + path
path0 = path[1:len(path)]+ds+"ScrapyDatastore"+ds+"src"
path1 = path+ds+"ExtraFunctions"+ds+"src"
path2 = path+ds+"filterforname"+ds+"src"
path3 = path0+path1+path2
os.environ['PYTHONPATH'] = path3

#run connection setup
path4 = path
path4 = path4.replace(ps,"")
path4 = path4+ds+"consetup.py"
subprocess.call(["python", path4, path])




#run mail service
a1 = ds+"tmp"+ds+"filteredinfibeam.csv"
a2 = ds+"tmp"+ds+"filteredindiaplaza.csv"
a3 = ds+"tmp"+ds+"filteredbabuchak.csv"
a4 = ds+"tmp"+ds+"filterednaaptol.csv"
a5 = ds+"tmp"+ds+"filteredunivercell.csv"
a6 = ds+"tmp"+ds+"themobstore_new.csv"

print "#123 sending emails"
attach = [a1,a2,a3,a5,a6]
mail("ashish.singh@shop2020.in",
   "Files for different vendors",
   "This mail is automatically generated via python script",
   attach)
'''
mail("pankaj.jain@shop2020.in",
   "Files for different vendors",
   "This mail is automatically generated via python script",
   attach)
'''