Skip to content

Commit

Permalink
more porting to python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniogi committed Sep 30, 2024
1 parent f2be860 commit 8135cc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/SolverDAB.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self, ProblemType, infile):
self.__solution_type = 0
self.__problem = None
self.__bestLocalSolution = None
self.__bestGlobalSolution = None
self.__bestLocalInitialised = False
#Number of iterations since the local solution
#was created
Expand Down
10 changes: 5 additions & 5 deletions src/VMECProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,17 +675,17 @@ def run_ballooning(self):
"""

def run_mercier(self):
if(not self.__check_mercier):
if not self.__check_mercier:
return True
try:
filename = "mercier.tj" + self.__rank
if(not os.path.exists(filename)):
if not os.path.exists(filename):
u.logger.error("VMECProcess(" + self.__rank + "): File " +
str(filename) + " doesn't exist")
return False
f = open(filename, 'r')
line = f.readline()
while(string.find(line, 'DMerc') == -1):
while line.find('DMerc') == -1:
line = f.readline()

f.readline()
Expand All @@ -695,8 +695,8 @@ def run_mercier(self):
sign_change = False
self.__is_mercier_stable = True
while(line):
linestrip = string.strip(line)
new_line = string.replace(linestrip, ' ', ' ')
linestrip = line.strip()
new_line = linestrip.replace(' ', ' ')
parts = new_line.split()
# parts = map(string.strip, string.split(new_line, ' '))
Si, DMerci, DSheari, DCurri, DWelli, Dgeodi = parts
Expand Down
4 changes: 2 additions & 2 deletions src/Worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, comm, problem_type):
elif self.__problem_type == u.problem_type.NONSEPARABLE:
self.__problem = ProblemNonSeparable()
except Exception as e:
print("Worker " + str(sys.exception().exc.__traceback__.tb_lineno) + " " + str(e))
print("Worker " + str(sys.exc_info()[2].tb_lineno) + " " + str(e))

#This is the worker. It sends a request for data, then receives
#a solution and the bee index.
Expand Down Expand Up @@ -148,7 +148,7 @@ def run(self, infile, cfile):
str(solutions_evaluated))
except Exception as e:
u.logger.error("WORKER (" + str(self.__rank) + ")" +
str(sys.exception().exc.__traceback__.tb_lineno) + " " + str(e))
str(sys.exc_info()[2].tb_lineno) + " " + str(e))

#This method just checks if there is message from the driver indicating the
#end of the simulation
Expand Down

0 comments on commit 8135cc5

Please sign in to comment.