Skip to content

Commit

Permalink
Switching back to using shell=False in Popen(["gmsh" ...).
Browse files Browse the repository at this point in the history
Discover that the local "fake" gmsh script was not being sourced as a
shell script as it didn't have the #! at the top. Nothing to do with
`shell=True` or `shell=False`.
  • Loading branch information
wd15 committed Dec 18, 2012
1 parent 1634eb6 commit 20f82d6
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions fipy/meshes/gmshMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ class GmshException(Exception):
class MeshExportError(GmshException):
pass

def gmshPopen(cmd, stderr=None, stdout=None, shell=True):
cmd = ['gmsh'] + cmd
if shell:
cmd = ' '.join(cmd)
return Popen(cmd, stderr=stderr, stdout=stdout, shell=shell)


def gmshVersion(communicator=parallel):
"""Determine the version of Gmsh.
Expand All @@ -105,7 +98,7 @@ def gmshVersion(communicator=parallel):
if communicator.procID == 0:
while True:
try:
p = gmshPopen(["--version"], stderr=PIPE)
p = Popen(["gmsh", "--version"], stderr=PIPE)
except OSError, e:
verStr = None
break
Expand Down Expand Up @@ -231,7 +224,7 @@ def openMSHFile(name, dimensions=None, coordDimensions=None, communicator=parall
fileIsTemporary = True

while True:
p = gmshPopen([geoFile] + gmshFlags + ["-o", mshFile],
p = Popen(["gmsh", geoFile] + gmshFlags + ["-o", mshFile],
stdout=PIPE)

try:
Expand Down Expand Up @@ -1215,7 +1208,7 @@ def _test(self):
>>> f.close() # doctest: +GMSH
>>> if __name__ == "__main__":
... p = gmshPopen([os.path.join(dir, "g.msh")]) # doctest: +GMSH
... p = Popen(["gmsh", os.path.join(dir, "g.msh")]) # doctest: +GMSH
... doctest_raw_input("Grid2D... Press enter.")
>>> gg = GmshGrid2D(dx=1., dy=1., nx=10, ny=10)
Expand All @@ -1225,7 +1218,7 @@ def _test(self):
>>> f.close() # doctest: +GMSH
>>> if __name__ == "__main__":
... p = gmshPopen([os.path.join(dir, "gg.msh")]) # doctest: +GMSH
... p = Popen(["gmsh", os.path.join(dir, "gg.msh")]) # doctest: +GMSH
... doctest_raw_input("GmshGrid2D... Press enter.")
>>> ug = UniformGrid2D(nx = 10, ny = 10)
Expand All @@ -1244,7 +1237,7 @@ def _test(self):
>>> f.close() # doctest: +GMSH
>>> if __name__ == "__main__":
... p = gmshPopen([os.path.join(dir, "concat.msh")]) # doctest: +GMSH
... p = Popen(["gmsh", os.path.join(dir, "concat.msh")]) # doctest: +GMSH
... doctest_raw_input("Tri2D + Grid2D... Press enter.")
>>> g3d = Grid3D(nx=10, ny=10, nz=30)
Expand All @@ -1253,7 +1246,7 @@ def _test(self):
>>> f.close() # doctest: +GMSH
>>> if __name__ == "__main__":
... p = gmshPopen([os.path.join(dir, "g3d.msh")]) # doctest: +GMSH
... p = Popen(["gmsh", os.path.join(dir, "g3d.msh")]) # doctest: +GMSH
... doctest_raw_input("Grid3D... Press enter.")
>>> cyl = CylindricalGrid2D(nx=10, ny=10)
Expand All @@ -1262,7 +1255,7 @@ def _test(self):
>>> f.close() # doctest: +GMSH
>>> if __name__ == "__main__":
... p = gmshPopen([os.path.join(dir, "cyl.msh")]) # doctest: +GMSH
... p = Popen(["gmsh", os.path.join(dir, "cyl.msh")]) # doctest: +GMSH
... doctest_raw_input("CylindricalGrid2D... Press enter.")
>>> import shutil
Expand Down Expand Up @@ -1707,7 +1700,7 @@ def _test(self):
>>> from fipy import doctest_raw_input
>>> if __name__ == "__main__":
... p = gmshPopen([mshFile]) # doctest: +GMSH
... p = Popen(["gmsh", mshFile]) # doctest: +GMSH
... doctest_raw_input("Circle... Press enter.")
>>> os.remove(mshFile)
Expand Down

0 comments on commit 20f82d6

Please sign in to comment.