Error message while running a dynare code

I am using dynare 5.4. Frequently I get the attached error message. I have to reload matlab and then this issue sometimes disappears. Sometimes I have to rename the file and then it runs. It happ[ened with earlier versions of dynare too.

I am teaching dynare to students. Some of them also have the same problem. For some reason, dynare fails to identify the folder where the mod file residing in.

Thanks in advance for your help.

We occasionally have reports like this, e.g. Error dynare (line 278) evalin('base',[fname '.driver']);
but there seems to not be a uniform solution. Can you provide more details about the environment your are running Dynare in? Is it a network or could drive where the file is located?

Thank you for your response. I am teaching dynare to my students. Our school gives access to matlab of different versions starting from 2021 to all students. Students have installed either matlab 2022a or 2023a or 2023b in their laptops. Dynare can also be run from school computers in the lab. A number of students are having this issue with their laptops as well as in school comps which are in a network.

I have reported this to our IT. I suspect they will wash their hands off by saying that it is a problem of dynare. I suspect that it may be due to incorrect installation of matlab. I never encountered this problem in my own laptop in which I have a personal academic license of matlab. I faced this problem when I was running dynare 5.4.4 from school comp[uter once.
Any help will be appreciated.

As mentioned above, often it’s unsufficient write permissions in system folders, network folders, or slow cloud drives. Sometimes, the culprit is even an antivirus program blocking the creation of the respective files and folders. A first step is to always check whether the +modfilename-folder was created in the directory.

Do you mean dynare directory? I checked in my laptop. There is no +modfilename folder there.

When you run a mod-file, e.g. the example1.mod, then Dynare will create a package namespace +example1 as shown in the picture:

Only when this folder is created and accessible can commands like example1.driver be called. That call refers to the file +example1/driver.m being called.

If you don’t have the necessary permissions for the subfolder to be created in the folder where the mod-file is located or the creation is too slow (e.g. cloud drives), there may be an error message.

I think I understand what you mean. The package will be created in the folder from where my mod file is sitting right? If it doesn’t then there is a write permission issue. I am ruining a code called example1_2023 from my PC where I have created my working folder called dynare 2023 in my USB stick. I ran a mod which is sitting in that folder. It means things are fine. Please see attached pic. Am I right?
Sorry to be a pain.

Yes, exactly. There have been cases where users put the mod-file in a subfolder of the Matlab installation. In that case, it happened that the folder was created, but you nevertheless got the error message that the name could not be resolved.

Many thanks for this troubleshooting. I will advise students accordingly.

Thanks. And if you find systematic patterns, please report back.