Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get gmsh version from stderr or stdout #846

Merged
merged 3 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ worktrees/
dictionary.dic
en_US.aff
en_US.dic
build/
8 changes: 6 additions & 2 deletions fipy/meshes/gmshMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def gmshVersion(communicator=parallelComm):
while True:
try:
# gmsh returns version in stderr (Why?!?)
# (newer versions of gmsh return the version in stdout)
# spyder on Windows throws
# OSError: [WinError 6] The handle is invalid
# if we don't PIPE stdout, too
Expand All @@ -77,8 +78,11 @@ def gmshVersion(communicator=parallelComm):
break

try:
out, verStr = p.communicate()
verStr = verStr.decode('ascii').strip()
out, err = p.communicate()
verStr = err.decode('ascii').strip()
if not verStr:
# newer versions of gmsh return the version in stdout
verStr = out.decode('ascii').strip()
break
except IOError:
# some weird conflict with things like PyQT can cause
Expand Down