How to specify inp file path to epanet

Sorry if this is a naive newbie question. Couldn’t find anything in the doc about it.
If I put a path such as


I get the following error messsage:

Error using epanet (line 4072)
File “C:/Biz/folder1/xxx.inp” is not a valid.

While if I put the inp file in the Matlab current dir it works. Is there a way to specify a path that is not the same a pwd as well as a filename to epanet?
I know that changing pwd, invoking epanet.m and then going back will work but that’s rather clumsy.

Hi @elhay,

Thank you for your feedback!
You can try again to update the EPyT version.

pip install epyt --upgrade

You can try one of the following examples.

from epyt import epanet

d = epanet(r"C:\Users\username\Desktop\L-TOWN.inp")
d = epanet(“C:/Users/mkiria01/Desktop/L-TOWN.inp”)
d = epanet(“C:\Users\mkiria01\Desktop\L-TOWN.inp”)
d = epanet(os.path.join(os.path.expanduser(’~’), ‘Desktop’, ‘L-TOWN.inp’))


Hi. Thanks for your reply. AFAIK I’m not using python, only Matlab. Have I got that wrong?

Sorry, I thought that was for the python toolkit!

Please for the epanet matlab toolkit I suggest using your network in a folder on the current dir like the following screenshot. I create a new folder mynetworks and my inp file mynet.inp. The important folder is the epanet_matlab_toolkit.

You can remove some unnecessary folders (examples, tests, etc.) if you want.


Thanks for that. I have a workaround - change dir, load file, change back - but that’s clumsy and I was looking for a better solution. Oh, well.