refactory old scripts
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
from mysql.connector import MySQLConnection, Error
|
||||
|
||||
from dbconfig import read_db_config
|
||||
from datetime import datetime
|
||||
import math
|
||||
import shutil
|
||||
from mysql.connector import Error, MySQLConnection
|
||||
|
||||
|
||||
def removeDuplicates(lst):
|
||||
return list(set([i for i in lst]))
|
||||
@@ -14,7 +12,7 @@ def getDataFromCsvAndInsert(pathFile):
|
||||
try:
|
||||
print(pathFile)
|
||||
folder_name = pathFile.split("/")[-2]#cartella
|
||||
with open(pathFile, 'r') as file:
|
||||
with open(pathFile) as file:
|
||||
data = file.readlines()
|
||||
data = [row.rstrip() for row in data]
|
||||
if(len(data) > 0 and data is not None):
|
||||
@@ -112,7 +110,7 @@ def getDataFromCsvAndInsert(pathFile):
|
||||
#print(unit_name, tool_name, 30, E8_184_CH6)
|
||||
#print(unit_name, tool_name, 31, E8_184_CH7)
|
||||
#print(unit_name, tool_name, 32, E8_184_CH8)
|
||||
#---------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------
|
||||
dataToInsertRaw.append((unit_name, tool_name, 1, date, time, an4, -273, E8_181_CH1))
|
||||
dataToInsertRaw.append((unit_name, tool_name, 2, date, time, an4, -273, E8_181_CH2))
|
||||
dataToInsertRaw.append((unit_name, tool_name, 3, date, time, an4, -273, E8_181_CH3))
|
||||
@@ -253,7 +251,7 @@ def getDataFromCsvAndInsert(pathFile):
|
||||
#print(unit_name, tool_name, 63, E8_184_CH7)
|
||||
#print(unit_name, tool_name, 64, E8_184_CH8)
|
||||
#print(rowSplitted)
|
||||
#---------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------
|
||||
dataToInsertRaw.append((unit_name, tool_name, 41, date, time, an4, -273, E8_182_CH1))
|
||||
dataToInsertRaw.append((unit_name, tool_name, 42, date, time, an4, -273, E8_182_CH2))
|
||||
dataToInsertRaw.append((unit_name, tool_name, 43, date, time, an4, -273, E8_182_CH3))
|
||||
|
||||
Reference in New Issue
Block a user