Skip to content
Snippets Groups Projects
Commit 32c79b69 authored by Auke Klazema's avatar Auke Klazema
Browse files

SW-658: Add str encode to convert string to bytes in createFiles

parent 48344ebb
No related branches found
No related tags found
No related merge requests found
......@@ -44,8 +44,8 @@ def findIPNumber(stationName):
command = "hostname -i"
output = Popen(command,shell=True, stdout=PIPE).stdout
stdout = output.readlines()
outline = stdout[0].strip()
outwords = outline.split().decode("UTF-8")
outline = stdout[0].strip().decode("UTF-8")
outwords = outline.split()
if (len(outwords) != 1):
return "-1"
else:
......@@ -55,8 +55,8 @@ def findIPNumber(stationName):
command = "getent hosts "+stationName+"C"
output = Popen(command,shell=True, stdout=PIPE).stdout
stdout = output.readlines()
outline = stdout[0].strip()
outwords = outline.split().decode("UTF-8")
outline = stdout[0].strip().decode("UTF-8")
outwords = outline.split()
if (len(outwords) < 2):
print("Could not find IP for station, assuming 10.150.1.1")
return "10.150.1.1"
......@@ -466,7 +466,7 @@ def createRSPDriverFile(resultDir, stationName, dataDir,int_local,is_Cobalt):
RSPconfig = RSPconfig.replace(repl_str, ethport)
outFile = os.open(dataDir+"/RSPDriver.conf.tmp", os.O_RDWR|os.O_CREAT|os.O_TRUNC)
os.write(outFile, RSPconfig)
os.write(outFile, RSPconfig.encode())
os.close(outFile)
......@@ -604,7 +604,7 @@ def createRSPDriverFile_Test(resultDir, stationName, dataDir, alias):
RSPconfig = RSPconfig.replace(repl_str, ethport)
outFile = os.open(dataDir+"/RSPDriver.conf.tmp", os.O_RDWR|os.O_CREAT|os.O_TRUNC)
os.write(outFile, RSPconfig)
os.write(outFile, RSPconfig.encode())
os.close(outFile)
# An ugly way to get rid of all lines in the template file that are not
......@@ -693,7 +693,7 @@ def createTBBDriverFile(resultDir, stationName, dataDir):
TBBconfig = TBBconfig.replace(repl_str, ethport)
outFile = os.open(dataDir+"/TBBDriver.conf.tmp", os.O_RDWR|os.O_CREAT|os.O_TRUNC)
os.write(outFile, TBBconfig)
os.write(outFile, TBBconfig.encode())
os.close(outFile)
# An ugly way to get rid of all lines in the template file that are not
# filled yet.
......@@ -723,7 +723,7 @@ def createRemoteStationFile(resultDir, stationName, dataDir):
RSconfig = RSconfig.replace("@AARTFAAC@", Aartfaac)
outFile = os.open(resultDir+"/RemoteStation.conf", os.O_RDWR|os.O_CREAT|os.O_TRUNC)
os.write(outFile, RSconfig)
os.write(outFile, RSconfig.encode())
os.close(outFile)
......@@ -839,7 +839,7 @@ def createHardwareMonitorFile(resultDir, stationName, dataDir, last_ip="3"):
HWMconfig = HWMconfig.replace("@STATION@", stationName.upper())
HWMconfig = HWMconfig.replace("@IP_ENV_CONTR@", HWMip)
outFile = os.open(resultDir+"/HardwareMonitor.conf", os.O_RDWR|os.O_CREAT|os.O_TRUNC)
os.write(outFile, HWMconfig)
os.write(outFile, HWMconfig.encode())
os.close(outFile)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment