zanoni-mbdyn / blendyn

MBDyn (https://www.mbdyn.org/) graphical post-processor for blender (https://www.blender.org/)
GNU General Public License v2.0
40 stars 8 forks source link

plotting of NetCDF variables fails when variable names differ by only lowercase/uppercase #31

Closed zanoni-mbdyn closed 6 years ago

zanoni-mbdyn commented 7 years ago

When plotting NetCDF variables, if a request is made to plot variables that differ only for lowercase/uppercase, e.g.

dd0.elem.joint.11.D
dd0.elem.joint.11.d

an exception is raised:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/urllib/request.py", line 1410, in open_local_file
    stats = os.stat(localfile)
FileNotFoundError: [Errno 2] No such file or directory: '/home/zanoni/lavoro/mbdyn/mbdyn-src/tests/joints/deformablehinge/test/plots/dd0.elem.joint.11.D.svg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zanoni/.config/blender/2.78/scripts/addons/blendyn-master/plotlib.py", line 517, in execute
    cairosvg.svg2png(url = outfname + ".svg", write_to = outfname + ".png")
  File "/usr/lib64/python3.5/site-packages/cairosvg/__init__.py", line 45, in <lambda>
    surface_type.convert(*args, **kwargs))(_surface_type)
  File "/usr/lib64/python3.5/site-packages/cairosvg/surface.py", line 135, in convert
    tree = Tree(**kwargs)
  File "/usr/lib64/python3.5/site-packages/cairosvg/parser.py", line 385, in __init__
    parse_url(self.url), 'image/svg+xml')
  File "/usr/lib64/python3.5/site-packages/cairosvg/parser.py", line 258, in fetch_url
    return read_url(url, self.url_fetcher, resource_type)
  File "/usr/lib64/python3.5/site-packages/cairosvg/url.py", line 96, in read_url
    return url_fetcher(url, resource_type)
  File "/usr/lib64/python3.5/site-packages/cairosvg/url.py", line 42, in fetch
    return urlopen(Request(url, headers=HTTP_HEADERS)).read()
  File "/usr/lib64/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.5/urllib/request.py", line 466, in open
    response = self._open(req, data)
  File "/usr/lib64/python3.5/urllib/request.py", line 484, in _open
    '_open', req)
  File "/usr/lib64/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.5/urllib/request.py", line 1388, in file_open
    return self.open_local_file(req)
  File "/usr/lib64/python3.5/urllib/request.py", line 1428, in open_local_file
    raise URLError(exp)
urllib.error.URLError: <urlopen error [Errno 2] No such file or directory: '/home/zanoni/lavoro/mbdyn/mbdyn-src/tests/joints/deformablehinge/test/plots/dd0.elem.joint.11.D.svg'>

location: <unknown location>:-1

location: <unknown location>:-1

and the resulting files in the plots/ directory are

dd0.elem.joint.11.d.png
dd0.elem.joint.11.d.svg
dd0.elem.joint.11.d (Conflitto di maiuscole o minuscole (1)).png
dd0.elem.joint.11.d (Conflitto di maiuscole o minuscole (1)).svg

My guess here is that Pygal is the culprit, but I haven't had the time to investigate thoroughly...

janga1997 commented 7 years ago

@zanoni-mbdyn The issue isn't related to how plotting works, but just file-naming. It should be easy to fix. I'll fix it ASAP.

zanoni-mbdyn commented 6 years ago

Fixed in bugfix for now. Will merge in master once done with testing.