I am using flopy package to change the content of well package and then to run the model and finally get all output heads. I have loaded my model successfully and I have changed the content of well package but when it comes to running the model after all these changes I've got this error. You know, there is no file named .name file in the file of my model but instead I have used ".mfn" file which can be considered as an alternative for ".name" file in my model. I don't know how can I solve this problem. Thanks in advance for your answers. Here is my written code:
import flopy
import os
import sys
first = flopy.modflow.Modflow.load("step6.mfn", version='mf2k',exe_name=mf2k.exe", verbose =True , model_ws = "step6._ws" , load_only=None , forgive=False , check =False )
success, buff = first.run_model()
if not success:
raise Exception("MODFLOW did not terminate normally.")
And here is the error:
----> 5 success, buff = first.run_model()
6 if not success:
7 raise Exception("MODFLOW did not terminate normally.")
File C:\Python27\anaconda\lib\site-packages\flopy\mbase.py:1361, in BaseModel.run_model(self, silent, pause, report, normal_msg)
1330 def run_model(
1331 self,
1332 silent=False,
(...)
1335 normal_msg="normal termination",
1336 ):
1337 """
1338 This method will run the model using subprocess.Popen.
1339
(...)
1358
1359 """
-> 1361 return run_model(
1362 self.exe_name,
1363 self.namefile,
1364 model_ws=self.model_ws,
1365 silent=silent,
1366 pause=pause,
1367 report=report,
1368 normal_msg=normal_msg,
1369 )
File C:\Python27\anaconda\lib\site-packages\flopy\mbase.py:1708, in run_model(exe_name, namefile, model_ws, silent, pause, report, normal_msg, use_async, cargs)
1706 if namefile is not None:
1707 if not os.path.isfile(os.path.join(model_ws, namefile)):
-> 1708 raise Exception(
1709 f"The namefile for this model does not exists: {namefile}"
1710 )
1712 # simple little function for the thread to target
1713 def q_output(output, q):
Exception: The namefile for this model does not exists: step6.nam