Skip to content

Commit c663b97

Browse files
committed
Yet another Python 2 compatibility fix
1 parent 2282545 commit c663b97

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

OMPython/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,10 @@ def simulate(self,resultfile=None,simflags=None,overrideaux=None): # 11
13241324
# os.system(cmd) # Original code
13251325
# p = subprocess.Popen([cmd], stdout=subprocess.PIPE)
13261326
# print(str(cmd))
1327-
p = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1327+
try: # Python 3
1328+
p = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1329+
except: # Python 2
1330+
p = subprocess.call(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
13281331
# p = subprocess.run([getExeFile, r], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
13291332
out = p.stdout # .read()
13301333
self.simulationFlag = True

0 commit comments

Comments
 (0)