My second snap ;-)

Robert Park robert.park at canonical.com
Sun Oct 2 07:54:31 UTC 2016


Hi all!

Back again with a second attempt, this time I'm not trying to modify
the host system so I'm hoping this should be a lot easier/possible!

Here's my snapcraft.yaml:

https://git.launchpad.net/~robru/+git/weightloss/tree/snapcraft.yaml

Pretty simple little flask webapp, just does some data manipulations
and then serves graphics over HTTP.

Snap builds ok but when I run it I get this:

 weighttracker
Traceback (most recent call last):
  File "/snap/weighttracker/x2/run.py", line 15, in <module>
    from graph import draw
  File "/snap/weighttracker/x2/graph.py", line 14, in <module>
    from matplotlib.dates import DateFormatter
  File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/matplotlib/__init__.py",
line 1133, in <module>
    rcParams = rc_params()
  File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/matplotlib/__init__.py",
line 977, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/matplotlib/__init__.py",
line 1102, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/matplotlib/__init__.py",
line 1020, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "/snap/weighttracker/x2/usr/lib/python3.5/contextlib.py", line
59, in __enter__
    return next(self.gen)
  File "/snap/weighttracker/x2/usr/lib/python3/dist-packages/matplotlib/__init__.py",
line 1005, in _open_file_or_url
    with io.open(fname, encoding=encoding) as f:
PermissionError: [Errno 13] Permission denied: '/etc/matplotlibrc'


Not really sure what's going on, but it looks like matplotlib is
hard-coding "/etc":

$ cat /snap/weighttracker/x2/usr/lib/python3/dist-packages/matplotlib/__init__.py
| grep /etc
    path = '/etc'  # guaranteed to exist or raise


Do I have to patch matplotlib here or is there some way snapcraft can
fix this for me?

(frustratingly the matplotlib code seems to harmlessly ignore the file
if it doesn't exist, but they didn't anticipate the idea that they
wouldn't have permission, so the code just barfs)



Thanks.

-- 
robru




More information about the Snapcraft mailing list