| 1336 |
rajveer |
1 |
import os
|
|
|
2 |
import sys
|
|
|
3 |
import subprocess
|
|
|
4 |
from mail import *
|
|
|
5 |
|
|
|
6 |
"""
|
|
|
7 |
Documentation for script test.py
|
|
|
8 |
This is the script which one has to run if he wish to run the software
|
|
|
9 |
First it will run the consetup.py, which in turn run the spiders for individual suppliers.
|
|
|
10 |
Then, the generated csv files would be mailed to administrators.
|
|
|
11 |
@param path to the folder in which spider-projects reside (/home/gaurav/code)
|
|
|
12 |
"""
|
|
|
13 |
|
|
|
14 |
#pathsep = Separator between paths(for ubuntu ':')
|
|
|
15 |
#sep = Separator between directories in a path(for ubuntu '/')
|
|
|
16 |
path = sys.argv[1]
|
|
|
17 |
ps = os.pathsep
|
|
|
18 |
ds = os.sep
|
|
|
19 |
|
|
|
20 |
#setting PYTHONPATH
|
|
|
21 |
path = ps + path
|
|
|
22 |
path0 = path[1:len(path)]+ds+"ScrapyDatastore"+ds+"src"
|
|
|
23 |
path1 = path+ds+"ExtraFunctions"+ds+"src"
|
|
|
24 |
path2 = path+ds+"filterforname"+ds+"src"
|
|
|
25 |
path3 = path0+path1+path2
|
|
|
26 |
os.environ['PYTHONPATH'] = path3
|
|
|
27 |
|
|
|
28 |
#run connection setup
|
|
|
29 |
path4 = path
|
|
|
30 |
path4 = path4.replace(ps,"")
|
|
|
31 |
path4 = path4+ds+"consetup.py"
|
|
|
32 |
subprocess.call(["python", path4, path])
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
#run mail service
|
|
|
38 |
a1 = ds+"tmp"+ds+"filteredinfibeam.csv"
|
|
|
39 |
a2 = ds+"tmp"+ds+"filteredindiaplaza.csv"
|
|
|
40 |
a3 = ds+"tmp"+ds+"filteredbabuchak.csv"
|
|
|
41 |
a4 = ds+"tmp"+ds+"filterednaaptol.csv"
|
|
|
42 |
a5 = ds+"tmp"+ds+"filteredunivercell.csv"
|
|
|
43 |
a6 = ds+"tmp"+ds+"themobstore_new.csv"
|
|
|
44 |
|
|
|
45 |
print "#123 sending emails"
|
|
|
46 |
attach = [a1,a2,a3,a5,a6]
|
|
|
47 |
mail("ashish.singh@shop2020.in",
|
|
|
48 |
"Files for different vendors",
|
|
|
49 |
"This mail is automatically generated via python script",
|
|
|
50 |
attach)
|
|
|
51 |
'''
|
|
|
52 |
mail("pankaj.jain@shop2020.in",
|
|
|
53 |
"Files for different vendors",
|
|
|
54 |
"This mail is automatically generated via python script",
|
|
|
55 |
attach)
|
|
|
56 |
'''
|