-
Notifications
You must be signed in to change notification settings - Fork 0
/
FromWorkComputer3.py~
48 lines (37 loc) · 1.51 KB
/
FromWorkComputer3.py~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import openpyxl
import os
import subprocess
import time
import sys
#wb = openpyxl.load_workbook('C:\\Users\\rnieva\\Documents\\Projects\\API2UploadDiagrams\\LSSJobsites_002_.xlsx')
#wbDummy=openpyxl.load_workbook('C:\\Users\\rnieva\\Documents\\Projects\\API2UploadDiagrams\\TestJobsites.xlsx')
wbDummyHome=openpyxl.load_workbook('C:\\Users\\ray\\Documents\\Projects\\Python\\TestJobsites.xlsx')
#sheet = wb.get_sheet_by_name('Sheet2')
#sheet=wbDummy.get_sheet_by_name('Sheet2')
sheet=wbDummyHome.get_sheet_by_name('Sheet2')
#for i in range(2, 4, 1):
# print(i, sheet.cell(row=i, column=1).value)
# c=(i, sheet.cell(row=i, column=1).value)
c=sys.argv[1]
i=int(c)
#i=1
jobsiteid=(sheet.cell(row=i, column=1).value)
print(jobsiteid)
# some code here writing to executable python file and close file
file=open('executeFile.py','w')
file.write('import requests\n')
file.write('#url=http://wrenetdev:8081/MarthaAPI/api/Storage/'+ str(jobsiteid) + '/UploadDiagram?userID=1113\n')
# add working request code
file.write('#with open(fileString, "rb") as f:\n')
file.write('# r=requests.post(url,file={fileString, f})\n')
file.write('print("Hello, World")\n')
file.write('output()')
file.close
input()
# execute python file
# run above created file
#time.sleep(20)
#subprocess.call("executeFile.py", shell=True)
# time delay and or confirm completion of file execution (try/catch block?)
# log that file has been processed
# This process will start again by virtue of top loop program using openpyx