Error n°2 python

Hello everyone, when i run tutorials in mfix 19.3.1 always get the same error. This is the message:

Error: [Errno 2] No such file or directory: ‘/opt/anaconda2/envs/mfix-19.3.1/lib/python3.7/site-packages/mfixgui/output_templates/custom’
File “…/widgets/run_popup.py”, line 443, in handle_run
if self.finish_with_dialog():
File “…/widgets/run_popup.py”, line 482, in finish_with_dialog
self.mfixgui.save_project()
File “…/gui.py”, line 2093, in save_project
self.project.writeDatFile(project_file, template=template)
File “…/project.py”, line 1535, in writeDatFile
dat_file.write(self.to_string(template=template))
File “…/project.py”, line 1524, in to_string
return mfixgui.expand_template.project_to_string(self, template=template)
File “…/expand_template.py”, line 497, in project_to_string
load_template(template)
File “…/expand_template.py”, line 38, in load_template
template_lines = [l.rstrip() for l in open(template_file)] # Remove trailing whitespace and newline

I Tried reinstalling conda (2 and 3) and mfix, even formatting my PC, but i always get the same problem

Hi Lawrence.

I am one of the MFIX developers and I’m the one responsible for this bit of code. I’m very sorry you went through so much trouble trying to remedy this error! There is nothing wrong with your Conda installation or your PC.

The “No such file or directory” error starts with “/opt/anaconda”, but this is just because all of MFIX is installed there.

In your MFIX settings, you can select different MFiX “file templates” - this controls the formatting of the .mfx file that MFIX saves. The default value is “Standard”. Some users wanted a different format, so we provided the “Detailed” template. And you are allowed to define your own “Custom” template, but in this case the template must be provided by you. It can be located in the project directory, or in the MFIX directory.

Somehow, your “File template” preference got set to Custom, but there is no Custom template. MFiX searched first in the project dir, then in the MFIX default directory, and didn’t find a template called “custom”. This is what the error message is trying to tell you. But I’m afraid it’s not a very user-friendly message. This will be improved in the upcoming 20.1.0 MFiX release.

To fix this, you can go to the main MFiX menu (“Hamburger” icon) and select “Settings”, and then set the “MFiX File Template” back to “Standard”. Or you can run mfix with the --clear flag to clear all saved user settings - from a Conda prompt, do python -m mfixgui --clear. (Note that this will clear ALL saved preferences, not just the template setting, so it’s a bit drastic - but not as drastic as reformatting your entire system!)

Hope this helps,

  • Charles

Thank you cgw, it’s good to know :slight_smile: