-
Notifications
You must be signed in to change notification settings - Fork 177
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
KeyError when rendering network graphics #341
Comments
Okay I found problem. I passed the wrong dict with pressures of nodes as the |
@FirokOtaku I had previously had problems with EPANET and unicode labels failing. My understanding is that EPANET only accepted 8-bit encoding, not unicode wide characters (certainly in the binary output file). Has this changed, then? I had not seen notice on the EPANET github that it had. |
When setting Chinese as major language of Windows, GBK would be the default encoding and lots of programs would just use that to perform filesystem IO. I'm not sure about how underlying code of EPANET runs. Only thing I can tell is that Hope that information can help a little. |
Fixes part of USEPA#341 relating to the discovery of a string encoding issue
Summary
I created a
.inp
file with some labels in Chinese by EPANET 2.2.The file was originally in GBK encoding and was converted to UTF-8.
A exception was thrown when trying to run simulation on that network (
sim = wntr.sim.EpanetSimulator(wn); results = sim.run_sim()
):It turns out
wntr/epanet/io.py
uselatin-1
encoding to perform filesystem IO everywhere. After replacing all thoselatin-1
toutf-8
, simulation can proceed normally. But a new exception was thrown:It seems that
wntr/graphics/network.py#L196
were trying to getj1
as a link which should be a node and cause that exception.Is there something wrong with my code or operation?
Or it's a bug of WNTR framework?
Example
Related
.inp
and.py
files are listed at here.Environment
all pakcage versions
The text was updated successfully, but these errors were encountered: