-
Notifications
You must be signed in to change notification settings - Fork 307
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
fix(exe path): FloPy now correctly resolves relative paths to mf6 executable (#1633) #1727
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1727 +/- ##
=======================================
Coverage 71.9% 71.9%
=======================================
Files 253 253
Lines 55996 56004 +8
=======================================
+ Hits 40275 40282 +7
- Misses 15721 15722 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, @jlarsen-usgs. And should the os.path routines be converted to pathlib? |
flopy/mbase.py
Outdated
raise Exception( | ||
f"The program {exe_name} does not exist or is not executable." | ||
) | ||
if os.path.dirname(exe_name) == "": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exe_name = Path(exe_name)
if str(exe_name.parent) = "":
flopy/mbase.py
Outdated
if os.path.dirname(exe_name) == "": | ||
exe = which(exe_name) | ||
if exe is None: | ||
if exe_name.lower().endswith(".exe"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if exe_name.suffix.lower() == ".exe"
flopy/mbase.py
Outdated
print( | ||
f"FloPy is using the following executable to run the model: {flopy_io.relpath_printstr(model_ws, exe)}" | ||
# make relative path into absolute path | ||
exe_name = os.path.abspath(exe_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exe_name = exe_name.absolute()
flopy/mbase.py
Outdated
f"FloPy is using the following executable to run the model: {flopy_io.relpath_printstr(model_ws, exe)}" | ||
# make relative path into absolute path | ||
exe_name = os.path.abspath(exe_name) | ||
if not os.path.exists(exe_name) and not os.path.exists( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not exe_name.exists() and not Path(f"{str(exe_name)}.exe").exits():
Left a few potential suggestions for changing this over to pathlib from os. There might be better methods for dealing with the paths in pathlib, but here's a few that I saw. |
@jlarsen-usgs All the pathlib changes you suggested have been added and the remaining exe path code has been updated for consistency. |
No description provided.