python - web2py fails on importing matplotlib modules -
i don't quite understand workings of web2py's custom_import.py
. attempting import modules withing mathplotlib
getting inconsistent results.
my controller version.py
contains these statements.
def import_mathlab_cbook(): import matplotlib.cbook cbook return "cbook.__file__ = %r" % cbook.__file__ def import_mathlab_figure(): matplotlib.figure import figure return "figure.__file__ = %r" % figure.__file__ def import_mathlab_backends(): matplotlib.backends.backend_agg import figurecanvasagg return "figurecanvasagg.__file__ = %r" % figurecanvasagg.__file__
the import of matplotlib.cbook works fine, others produce errors.
cbook.__file__ = '/opt/anaconda2/lib/python2.7/site-packages/matplotlib/cbook.py' traceback (most recent call last): file "/site/web2py.2.13.4/gluon/restricted.py", line 227, in restricted exec ccode in environment file "/site/web2py.2.13.4/applications/plotlab/controllers/version.py", line 53, in <module> file "/site/web2py.2.13.4/gluon/globals.py", line 412, in <lambda> self._caller = lambda f: f() file "/site/web2py.2.13.4/applications/plotlab/controllers/version.py", line 41, in import_mathlab_figure matplotlib.figure import figure file "/site/web2py.2.13.4/gluon/custom_import.py", line 95, in custom_importer return base_importer(pname, globals, locals, fromlist, level) importerror: no module named matplotlib.figure traceback (most recent call last): file "/site/web2py.2.13.4/gluon/restricted.py", line 227, in restricted exec ccode in environment file "/site/web2py.2.13.4/applications/plotlab/controllers/version.py", line 53, in <module> file "/site/web2py.2.13.4/gluon/globals.py", line 412, in <lambda> self._caller = lambda f: f() file "/site/web2py.2.13.4/applications/plotlab/controllers/version.py", line 46, in import_mathlab_backends matplotlib.backends.backend_agg import figurecanvasagg file "/site/web2py.2.13.4/gluon/custom_import.py", line 95, in custom_importer return base_importer(pname, globals, locals, fromlist, level) importerror: no module named matplotlib.backends.backend_agg
all of these import
statements work command line , when web2py run @ command line.
# python web2py.py -s welcome -p web2py web framework created massimo di pierro, copyright 2007-2016 version 2.13.4-stable+timestamp.2015.12.26.04.59.39 database drivers available: sqlite3, imaplib, pymysql, pg8000 python 2.7.11 |anaconda 2.4.1 (64-bit)| (default, dec 6 2015, 18:08:32) [gcc 4.4.7 20120313 (red hat 4.4.7-1)] on linux2 type "help", "copyright", "credits" or "license" more information. (interactiveconsole) >>> >>> import matplotlib.cbook cbook >>> >>> matplotlib.figure import figure >>> >>> matplotlib.backends.backend_agg import figurecanvasagg
i running python 2.7.11 |anaconda 2.4.1 (64-bit)| (default, dec 6 2015, 18:08:32)
, web2py version 2.13.4-stable+timestamp.2015.12.26.04.59.39
.
i know there similar question regarding importing copy_reg module, answer has yet accepted problem.
Comments
Post a Comment