diff --git a/.gitignore b/.gitignore index d096d4c..f13ca36 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ tiles/* # Python compiled files __pycache__/ + +.temp/ \ No newline at end of file diff --git a/py2Lib/bit.py b/py2Lib/bit.py index c21a29f..49af6e2 100644 --- a/py2Lib/bit.py +++ b/py2Lib/bit.py @@ -30,13 +30,13 @@ def sendFile(files, commands, numSgmts, Pri): l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...") exit() #Get the next message ID - with open('C:\\Clips\\msgId.txt', "r") as f: + with open('./.temp/msgId.txt', "r") as f: oMsgId = f.read() msgNum = int(oMsgId) f.close() nMsgNum = msgNum + 1 - h = open('C:\\Clips\\msgId.txt', "w") + h = open('./.temp/msgId.txt', "w") h.write(str(nMsgNum)) h.close() segnmNum = 0 @@ -122,13 +122,13 @@ def sendCommand(command, Pri, msgNum = None): l.critical("Invalid Priority Flag. 0 = Routine Message 1 = High Priority Message\n\nScript will now terminate...") exit() #Get the next message ID - with open('C:\\Clips\\msgId.txt', "r") as f: + with open('./.temp/msgId.txt', "r") as f: oMsgId = f.read() msgNum = int(oMsgId) f.close() nMsgNum = msgNum + 1 - h = open('C:\\Clips\\msgId.txt', "w") + h = open('./.temp/msgId.txt', "w") h.write(str(nMsgNum)) h.close() segnmNum = 0 @@ -140,15 +140,15 @@ def sendCommand(command, Pri, msgNum = None): for x in command: bx = bytes(x, 'utf-8') - with open('D:\\command', 'wb') as c: + with open('./.temp/command', 'wb') as c: c.write(bx) c.close() - size = os.path.getsize('D:\\command') + size = os.path.getsize('./.temp/command') encode1 = bytes('I2MSG', 'UTF-8') commandLength = size encode2 = commandLength.to_bytes(4, byteorder='little') theCommand = b"".join([encode1, encode2]) - with open('D:\\command', 'ab') as d: + with open('./.temp/command', 'ab') as d: d.write(theCommand) d.close() check = size - BUF_SIZE @@ -162,14 +162,14 @@ def sendCommand(command, Pri, msgNum = None): pc = packet_count.to_bytes(4, byteorder='little') i = 0 char = '' - new_size = os.path.getsize('D:\\command') + new_size = os.path.getsize('./.temp/command') if startFlag == False: #Our 34 byte beginning packet p1 = struct.pack(">BHHHIIBBBBBBBIBIBBB", 18, 1, 0 , 16, msgNum, 0, segnmNum, 0, 0, 8, numSegments, 3, 0, 0, 8, packRounded, 0, 0, 0) conn.sendto(p1, (MCAST_GRP, MCAST_PORT)) startFlag = True - with open('D:\\Command',"rb") as message: + with open('./.temp/Command',"rb") as message: message.seek(0) data = message.read(BUF_SIZE) while data: @@ -212,16 +212,16 @@ def sendCommand(command, Pri, msgNum = None): #Send Current Observations -#sendFile("C:\\Clips\\CurrentObservations.i2m.gz", 'I2MSG', 0) +#sendFile("./.temp/CurrentObservations.i2m.gz", 'I2MSG', 0) #time.sleep(10) #Send Hourly Forecast -#sendFile("C:\\Clips\\HourlyForecast.i2m.gz", 'I2MSG', 0) +#sendFile("./.temp/HourlyForecast.i2m.gz", 'I2MSG', 0) #time.sleep(10) #Send Daily Forecast -#sendFile("C:\\Clips\\DailyForecast.i2m.gz", 'I2MSG', 0) +#sendFile("./.temp/DailyForecast.i2m.gz", 'I2MSG', 0) #Send radar image -#sendFile("C:\\Clips\\radar.i2m", 'I2MSG', 0) +#sendFile("./.temp/radar.i2m", 'I2MSG', 0) #Load Local On The 8s #sendCommand('I2MSG', 1) @@ -249,16 +249,16 @@ def sendCommand(command, Pri, msgNum = None): #sendCommand('040500I2MSG', 1) #Set ANF Mode -#sendFile("C:\\Clips\\ANFOn.i2m",'040500040449030025I2MSG', 1) +#sendFile("./.temp/ANFOn.i2m",'040500040449030025I2MSG', 1) #SendBundle -#sendFile("C:\\Clips\\Bundles.zip",'I2MSG', 0) +#sendFile("./.temp/Bundles.zip",'I2MSG', 0) #Send Upgrade -#sendFile("C:\\Clips\\Upgrades\\maintenance_1.0.0.50.zip",'I2MSG', 0) +#sendFile("./.temp/Upgrades/maintenance_1.0.0.50.zip",'I2MSG', 0) #Stage Upgrade #sendCommand('I2MSG', 0) #Change Passwords -#sendFile("C:\\Clips\\passwords.i2m",'I2MSG', 0) \ No newline at end of file +#sendFile("./.temp/passwords.i2m",'I2MSG', 0) \ No newline at end of file diff --git a/py2Lib/command.py b/py2Lib/command.py index 48449b1..4de51e8 100644 --- a/py2Lib/command.py +++ b/py2Lib/command.py @@ -129,7 +129,7 @@ def sendStarBundle(File): count = file_number - 1 part = 1 - with open('C:\\Clips\\msgId.txt', "r") as f: + with open('./.temp/msgId.txt', "r") as f: oMsgId = f.read() Id = int(oMsgId) f.close() @@ -186,7 +186,7 @@ def sendUpgrade(File, RelName): count = file_number - 1 part = 1 - with open('C:\\Clips\\msgId.txt', "r") as f: + with open('./.temp/msgId.txt', "r") as f: oMsgId = f.read() Id = int(oMsgId) f.close() @@ -213,7 +213,7 @@ def sendUpgrade(File, RelName): def makeStarBundle(Directory, Type, flag, Version, date, sendAfter): header = '\n ' + Version + '\n ' + date + '\n ' + Type + '\n \n' - with open('D:\\i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'w') as ma: + with open('./.temp/i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'w') as ma: ma.write(header) ma.close() @@ -222,7 +222,7 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter): rootDir = root[24:] bDest = os.path.join(rootDir,name) fDest = os.path.join(root,name) - shutil.copy(fDest, 'D:\\i2State\\SD\\ChangesetBundle') + shutil.copy(fDest, './.temp/i2State\\SD\\ChangesetBundle') for name in files: if flag == 'Domestic_Universe': flag = 'flags="Domestic_Universe"' @@ -230,11 +230,11 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter): flag = 'flags="Domestic_SD_Universe"' else: pass - with open('D:\\i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as mb: + with open('./.temp/i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as mb: mb.write(' \n') mb.close() closer = ' \n' - with open('D:\\i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as ma: + with open('./.temp/i2State\\SD\\ChangesetBundle\\MetaData\\manifest.xml', 'a') as ma: ma.write(closer) ma.close() @@ -249,22 +249,22 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter): #loadRunPres(['038488'], 'domestic/ldlE', '', '72000', 'LDL1') -#changePasswords('C:\\Clips\\passwords2.gz', ['006833']) +#changePasswords('./.temp/passwords2.gz', ['006833']) -#sendMaintCommand('C:\\Clips\\maint\\temp\\passwords',['040500']) +#sendMaintCommand('./.temp/maint\\temp\\passwords',['040500']) -#sendStarBundle("C:\\Clips\\Bundle.zip") +#sendStarBundle("./.temp/Bundle.zip") -#sendUpgrade("C:\\Clips\\Upgrades\\wireshark_1.4.6.0.zip", "wireshark_1.4.6.0") +#sendUpgrade("./.temp/Upgrades\\wireshark_1.4.6.0.zip", "wireshark_1.4.6.0") #For splitting -#sendUpgrade("C:\\Clips\\ChangesetHD.zip", "PipelineMaint_6.15.1.5714") +#sendUpgrade("./.temp/ChangesetHD.zip", "PipelineMaint_6.15.1.5714") #For no split upgrades -#bit.sendFile('C:\\Clips\\Upgrades\\vizRequiredFilesForI2_1.2.0.0.zip', '040500I2MSG', 0) +#bit.sendFile('./.temp/Upgrades\\vizRequiredFilesForI2_1.2.0.0.zip', '040500I2MSG', 0) #For split upgrades -#bit.sendFile('C:\\Clips\\split\\ChangesetHD_04', 'I2MSG', 0) +#bit.sendFile('./.temp/split\\ChangesetHD_04', 'I2MSG', 0) #Command for split upgrades @@ -274,7 +274,7 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter): #commands.append(command) #bit.sendCommand(commands, 1, 0) -#bit.sendFile(['C:\\Clips\\Alert.gz'], [''], 1, 0) +#bit.sendFile(['./.temp/Alert.gz'], [''], 1, 0) ''' bit.sendCommand([''], 0) bit.sendCommand([''], 0) @@ -292,7 +292,7 @@ bit.sendCommand([''], 0) ''' #bit.sendCommand(['006833'], 1) -#bit.sendCommand('C:\\Clips\\Upgrades\\split\\PipelineMaint_6.15.1.5714_03', 'I2MSG', 0) +#bit.sendCommand('./.temp/Upgrades\\split\\PipelineMaint_6.15.1.5714_03', 'I2MSG', 0) @@ -305,5 +305,5 @@ bit.sendCommand([''], 1) -#makeStarBundle('D:\\i2State\\SD\\Changeset\\audio\\domesticSD\\vocalLocal\\Cantore', 'Changeset', 'Domestic_SD_Universe', '63702614401035937', '09/19/2022', 0) +#makeStarBundle('./.temp/i2State\\SD\\Changeset\\audio\\domesticSD\\vocalLocal\\Cantore', 'Changeset', 'Domestic_SD_Universe', '63702614401035937', '09/19/2022', 0) diff --git a/py2Lib/starbundle.py b/py2Lib/starbundle.py index cafebac..ae00c95 100644 --- a/py2Lib/starbundle.py +++ b/py2Lib/starbundle.py @@ -42,4 +42,4 @@ def makeStarBundle(Directory, Type, flag, Version, date, sendAfter): #Directory which contains Files to be bundled Type Flags Version Date SendImmediately(Does not apply to this script) -makeStarBundle('D:\\i2State\\SD\\Managed\\Events', 'Managed', 'Domestic_SD_Universe', '637898877227230030', '09/28/2022', 0) \ No newline at end of file +makeStarBundle('./.temp/i2State/SD/Managed/Events', 'Managed', 'Domestic_SD_Universe', '637898877227230030', '09/28/2022', 0) \ No newline at end of file diff --git a/recordGenerators/AirQuality.py b/recordGenerators/AirQuality.py index 29b6f30..c305e1d 100644 --- a/recordGenerators/AirQuality.py +++ b/recordGenerators/AirQuality.py @@ -38,7 +38,7 @@ def getData(epaId, zipcode): # Write to i2doc file i2Doc = f'' + '' + newData + f'{epaId}' - f = open("D:\\AirQuality.i2m", 'a') + f = open("./.temp/AirQuality.i2m", 'a') f.write(i2Doc) f.close() @@ -62,29 +62,29 @@ def writeData(): header = '' footer = "" - with open("D:\\AirQuality.i2m", 'w') as doc: + with open("./.temp/AirQuality.i2m", 'w') as doc: doc.write(header) for (x, y) in zip(workingEpaIds, zipCodes): getData(x, y) - with open("D:\\AirQuality.i2m", 'a') as end: + with open("./.temp/AirQuality.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\AirQuality.i2m") + dom = xml.dom.minidom.parse("./.temp/AirQuality.i2m") xmlPretty = dom.toprettyxml(indent = " ") - with open("D:\\AirQuality.i2m", 'w') as g: + with open("./.temp/AirQuality.i2m", 'w') as g: g.write(xmlPretty[23:]) g.close() files = [] commands = [] - with open("D:\\AirQuality.i2m", 'rb') as f_in: - with gzip.open("D:\\AirQuality.gz", 'wb') as f_out: + with open("./.temp/AirQuality.i2m", 'rb') as f_in: + with gzip.open("./.temp/AirQuality.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\AirQuality.gz" + gZipFile = "./.temp/AirQuality.gz" files.append(gZipFile) comand = commands.append('') @@ -92,8 +92,8 @@ def writeData(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\AirQuality.i2m") - os.remove("D:\\AirQuality.gz") + os.remove("./.temp/AirQuality.i2m") + os.remove("./.temp/AirQuality.gz") except Exception as e: l.error("DO NOT REPORT THE ERROR BELOW") l.error("Failed to write an AirQuality record.") diff --git a/recordGenerators/AirportDelays.py b/recordGenerators/AirportDelays.py index e248cc6..c5682ac 100644 --- a/recordGenerators/AirportDelays.py +++ b/recordGenerators/AirportDelays.py @@ -40,7 +40,7 @@ def getData(airport): # Write to i2doc file i2Doc = f'' + '' + newData + f'{airport}' - f = open("D:\\AirportDelays.i2m", 'a') + f = open("./.temp/AirportDelays.i2m", 'a') f.write(i2Doc) f.close() @@ -64,29 +64,29 @@ def writeData(): header = '' footer = "" - with open("D:\\AirportDelays.i2m", 'w') as doc: + with open("./.temp/AirportDelays.i2m", 'w') as doc: doc.write(header) for x in airportsWithDelays: getData(x) - with open("D:\\AirportDelays.i2m", 'a') as end: + with open("./.temp/AirportDelays.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\AirportDelays.i2m") + dom = xml.dom.minidom.parse("./.temp/AirportDelays.i2m") prettyXml = dom.toprettyxml(indent=" ") - with open("D:\\AirportDelays.i2m", 'w') as g: + with open("./.temp/AirportDelays.i2m", 'w') as g: g.write(prettyXml) g.close() files = [] commands = [] - with open("D:\\AirportDelays.i2m", 'rb') as f_in: - with gzip.open("D:\\AirportDelays.gz", 'wb') as f_out: + with open("./.temp/AirportDelays.i2m", 'rb') as f_in: + with gzip.open("./.temp/AirportDelays.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\AirportDelays.gz" + gZipFile = "./.temp/AirportDelays.gz" files.append(gZipFile) comand = commands.append('') @@ -94,7 +94,7 @@ def writeData(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\AirportDelays.i2m") - os.remove("D:\\AirportDelays.gz") + os.remove("./.temp/AirportDelays.i2m") + os.remove("./.temp/AirportDelays.gz") else: l.info("No airport delays found.") diff --git a/recordGenerators/Alerts.py b/recordGenerators/Alerts.py index ff3a401..3a5ec63 100644 --- a/recordGenerators/Alerts.py +++ b/recordGenerators/Alerts.py @@ -304,7 +304,7 @@ def getAlerts(location): alertMsg = 'NOT_USED' + x['productIdentifier'] + 'NOT_USED' + Action + '' + x['officeCode'] + '' + x['phenomena'] + '' + x['significance'] + '' + x['eventTrackingNumber'] + '' + x['eventDescription'] + 'NOT_USED' + EndTimeUTC + '' + str(x['severityCode']) + 'NOT_USED' + expireTimeUTC + '' + location + '' + x['adminDistrictCode'] + 'NOT_USEDNOT_USEDNOT_USED' + x['identifier'] + '' + processTime + '' + issueTimeUtc + '' + x['headlineText'] + '' + vocalCode + 'NOT_USED' + description + 'NOT_USED' + location + '_' + x['phenomena'] + '_' + x['significance'] + '_' + x['eventTrackingNumber'] + '_' + x['officeCode'] + '' #Append BERecord - with open('D:\\BERecord.xml', "a") as b: + with open('./.temp/BERecord.xml', "a") as b: b.write(alertMsg) b.close() @@ -317,39 +317,39 @@ def getAlerts(location): # TODO: This should be converted into a function so it works better with async, that way we're not getting hung up on that time.sleep() call. def makeRecord(): - with open("D:\\BERecord.xml", 'a') as BERecord: + with open("./.temp/BERecord.xml", 'a') as BERecord: BERecord.write('') BERecord.close() for z in zones: getAlerts(z) - with open('D:\\BERecord.xml', 'a') as BERecord: + with open('./.temp/BERecord.xml', 'a') as BERecord: BERecord.write("") BERecord.close() - dom = xml.dom.minidom.parse("D:\\BERecord.xml") + dom = xml.dom.minidom.parse("./.temp/BERecord.xml") pretty_xml_as_string = dom.toprettyxml(indent = " ") - with open("D:\\BERecord.i2m", 'w') as h: + with open("./.temp/BERecord.i2m", 'w') as h: h.write(pretty_xml_as_string[23:]) h.close() # If we don't need to send the i2 an alert, we don't need to gzip it. if k > 0: l.info("Sending alert(s) to the IntelliStar 2!") - with open("D:\\BERecord.i2m", 'rb') as f_in: - with gzip.open("D:\\BERecord.gz", 'wb') as f_out: + with open("./.temp/BERecord.i2m", 'rb') as f_in: + with gzip.open("./.temp/BERecord.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) files = [] commands = [] - gZipFile = "D:\\BERecord.gz" + gZipFile = "./.temp/BERecord.gz" files.append(gZipFile) command = commands.append('') bit.sendFile(files, commands, 1, 0) os.remove(gZipFile) k = 0 - os.remove("D:\\BERecord.xml") + os.remove("./.temp/BERecord.xml") \ No newline at end of file diff --git a/recordGenerators/Breathing.py b/recordGenerators/Breathing.py index 8797427..2385bf3 100644 --- a/recordGenerators/Breathing.py +++ b/recordGenerators/Breathing.py @@ -45,7 +45,7 @@ def getData(coopId, geocode): #Write to .i2m file i2Doc = '' + '' + newData + '' + str(coopId) + '' - f = open("D:\\Breathing.i2m", "a") + f = open("./.temp/Breathing.i2m", "a") f.write(i2Doc) f.close() @@ -55,30 +55,30 @@ def makeDataFile(): header = '' footer = '' - with open("D:\\Breathing.i2m", 'w') as doc: + with open("./.temp/Breathing.i2m", 'w') as doc: doc.write(header) for x, y in zip(coopIds, geocodes): getData(x, y) - with open("D:\\Breathing.i2m", 'a') as end: + with open("./.temp/Breathing.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\Breathing.i2m") + dom = xml.dom.minidom.parse("./.temp/Breathing.i2m") pretty_xml_as_string = dom.toprettyxml(indent = " ") - with open("D:\\Breathing.i2m", "w") as g: + with open("./.temp/Breathing.i2m", "w") as g: g.write(pretty_xml_as_string[23:]) g.close() files = [] commands = [] - with open("D:\\Breathing.i2m", 'rb') as f_in: - with gzip.open("D:\\Breathing.gz", 'wb') as f_out: + with open("./.temp/Breathing.i2m", 'rb') as f_in: + with gzip.open("./.temp/Breathing.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\Breathing.gz" + gZipFile = "./.temp/Breathing.gz" files.append(gZipFile) command = commands.append('') @@ -86,5 +86,5 @@ def makeDataFile(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\Breathing.i2m") - os.remove("D:\\Breathing.gz") \ No newline at end of file + os.remove("./.temp/Breathing.i2m") + os.remove("./.temp/Breathing.gz") \ No newline at end of file diff --git a/recordGenerators/CurrentObservations.py b/recordGenerators/CurrentObservations.py index 0f4286a..b589f45 100644 --- a/recordGenerators/CurrentObservations.py +++ b/recordGenerators/CurrentObservations.py @@ -45,7 +45,7 @@ def getData(tecci, zipCode): i2Doc = '' + '' + newData + '' + str(tecci) + '' - f = open("D:\\CurrentObservations.i2m", "a") + f = open("./.temp/CurrentObservations.i2m", "a") f.write(i2Doc) f.close() @@ -54,30 +54,30 @@ def makeDataFile(): header = '' footer = '' - with open("D:\\CurrentObservations.i2m", 'w') as doc: + with open("./.temp/CurrentObservations.i2m", 'w') as doc: doc.write(header) for x, y in zip(tecciId, zipCodes): getData(x, y) - with open("D:\\CurrentObservations.i2m", 'a') as end: + with open("./.temp/CurrentObservations.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\CurrentObservations.i2m") + dom = xml.dom.minidom.parse("./.temp/CurrentObservations.i2m") pretty_xml_as_string = dom.toprettyxml(indent = " ") - with open("D:\\CurrentObservations.i2m", "w") as g: + with open("./.temp/CurrentObservations.i2m", "w") as g: g.write(pretty_xml_as_string[23:]) g.close() files = [] commands = [] - with open("D:\\CurrentObservations.i2m", 'rb') as f_in: - with gzip.open("D:\\CurrentObservations.gz", 'wb') as f_out: + with open("./.temp/CurrentObservations.i2m", 'rb') as f_in: + with gzip.open("./.temp/CurrentObservations.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\CurrentObservations.gz" + gZipFile = "./.temp/CurrentObservations.gz" files.append(gZipFile) command = commands.append('') @@ -85,5 +85,5 @@ def makeDataFile(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\CurrentObservations.i2m") - os.remove("D:\\CurrentObservations.gz") + os.remove("./.temp/CurrentObservations.i2m") + os.remove("./.temp/CurrentObservations.gz") diff --git a/recordGenerators/DailyForecast.py b/recordGenerators/DailyForecast.py index 97d42c8..a13899d 100644 --- a/recordGenerators/DailyForecast.py +++ b/recordGenerators/DailyForecast.py @@ -42,7 +42,7 @@ def getData(tecci, zipCode): #Write to .i2m file i2Doc = '' + '' + newData + '' + str(tecci) + '' - f = open("D:\\DailyForecast.i2m", "a") + f = open("./.temp/DailyForecast.i2m", "a") f.write(i2Doc) f.close() @@ -52,30 +52,30 @@ def makeDataFile(): header = '' footer = '' - with open("D:\\DailyForecast.i2m", 'w') as doc: + with open("./.temp/DailyForecast.i2m", 'w') as doc: doc.write(header) for x, y in zip(tecciId, zipCodes): getData(x, y) - with open("D:\\DailyForecast.i2m", 'a') as end: + with open("./.temp/DailyForecast.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\DailyForecast.i2m") + dom = xml.dom.minidom.parse("./.temp/DailyForecast.i2m") pretty_xml_as_string = dom.toprettyxml(indent = " ") - with open("D:\\DailyForecast.i2m", "w") as g: + with open("./.temp/DailyForecast.i2m", "w") as g: g.write(pretty_xml_as_string[23:]) g.close() files = [] commands = [] - with open("D:\\DailyForecast.i2m", 'rb') as f_in: - with gzip.open("D:\\DailyForecast.gz", 'wb') as f_out: + with open("./.temp/DailyForecast.i2m", 'rb') as f_in: + with gzip.open("./.temp/DailyForecast.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\DailyForecast.gz" + gZipFile = "./.temp/DailyForecast.gz" files.append(gZipFile) command = commands.append('') @@ -83,5 +83,5 @@ def makeDataFile(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\DailyForecast.i2m") - os.remove("D:\\DailyForecast.gz") \ No newline at end of file + os.remove("./.temp/DailyForecast.i2m") + os.remove("./.temp/DailyForecast.gz") \ No newline at end of file diff --git a/recordGenerators/HourlyForecast.py b/recordGenerators/HourlyForecast.py index f0f6707..8ffc802 100644 --- a/recordGenerators/HourlyForecast.py +++ b/recordGenerators/HourlyForecast.py @@ -42,7 +42,7 @@ def getData(tecci, zipCode): #Write to .i2m file i2Doc = '' + '' + newData + '' + str(tecci) + '' - f = open("D:\\HourlyForecast.i2m", "a") + f = open("./.temp/HourlyForecast.i2m", "a") f.write(i2Doc) f.close() @@ -51,30 +51,30 @@ def makeDataFile(): header = '' footer = '' - with open("D:\\HourlyForecast.i2m", 'w') as doc: + with open("./.temp/HourlyForecast.i2m", 'w') as doc: doc.write(header) for x, y in zip(tecciId, zipCodes): getData(x, y) - with open("D:\\HourlyForecast.i2m", 'a') as end: + with open("./.temp/HourlyForecast.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\HourlyForecast.i2m") + dom = xml.dom.minidom.parse("./.temp/HourlyForecast.i2m") pretty_xml_as_string = dom.toprettyxml(indent = " ") - with open("D:\\HourlyForecast.i2m", "w") as g: + with open("./.temp/HourlyForecast.i2m", "w") as g: g.write(pretty_xml_as_string[23:]) g.close() files = [] commands = [] - with open("D:\\HourlyForecast.i2m", 'rb') as f_in: - with gzip.open("D:\\HourlyForecast.gz", 'wb') as f_out: + with open("./.temp/HourlyForecast.i2m", 'rb') as f_in: + with gzip.open("./.temp/HourlyForecast.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\HourlyForecast.gz" + gZipFile = "./.temp/HourlyForecast.gz" files.append(gZipFile) command = commands.append('') @@ -82,5 +82,5 @@ def makeDataFile(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\HourlyForecast.i2m") - os.remove("D:\\HourlyForecast.gz") \ No newline at end of file + os.remove("./.temp/HourlyForecast.i2m") + os.remove("./.temp/HourlyForecast.gz") \ No newline at end of file diff --git a/recordGenerators/PollenForecast.py b/recordGenerators/PollenForecast.py index d22f65b..5c5f2e6 100644 --- a/recordGenerators/PollenForecast.py +++ b/recordGenerators/PollenForecast.py @@ -46,7 +46,7 @@ def getData(pollenId, geocode): #Write to .i2m file i2Doc = '' + '' + newData + '' + str(pollenId) + '' - f = open("D:\\PollenForecast.i2m", "a") + f = open("./.temp/PollenForecast.i2m", "a") f.write(i2Doc) f.close() @@ -56,30 +56,30 @@ def makeDataFile(): header = '' footer = '' - with open("D:\\PollenForecast.i2m", 'w') as doc: + with open("./.temp/PollenForecast.i2m", 'w') as doc: doc.write(header) for x, y in zip(pollenIds, geocodes): getData(x, y) - with open("D:\\PollenForecast.i2m", 'a') as end: + with open("./.temp/PollenForecast.i2m", 'a') as end: end.write(footer) - dom = xml.dom.minidom.parse("D:\\PollenForecast.i2m") + dom = xml.dom.minidom.parse("./.temp/PollenForecast.i2m") pretty_xml_as_string = dom.toprettyxml(indent = " ") - with open("D:\\PollenForecast.i2m", "w") as g: + with open("./.temp/PollenForecast.i2m", "w") as g: g.write(pretty_xml_as_string[23:]) g.close() files = [] commands = [] - with open("D:\\PollenForecast.i2m", 'rb') as f_in: - with gzip.open("D:\\PollenForecast.gz", 'wb') as f_out: + with open("./.temp/PollenForecast.i2m", 'rb') as f_in: + with gzip.open("./.temp/PollenForecast.gz", 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - gZipFile = "D:\\PollenForecast.gz" + gZipFile = "./.temp/PollenForecast.gz" files.append(gZipFile) command = commands.append('') @@ -87,5 +87,5 @@ def makeDataFile(): bit.sendFile(files, commands, numFiles, 0) - os.remove("D:\\PollenForecast.i2m") - os.remove("D:\\PollenForecast.gz") \ No newline at end of file + os.remove("./.temp/PollenForecast.i2m") + os.remove("./.temp/PollenForecast.gz") \ No newline at end of file