[Qgis-developer] QGIS python 'import builtins' sometimes fails
C Hamilton
adenaculture at gmail.com
Thu Apr 13 10:39:31 PDT 2017
Recently it has come to my attention that plugins that are using 'import
builtins' fails on certain QGIS installs. For example using the following
causes this python error on my osgeo-live VM QGIS (2.14.3) install, but it
works fine on my Windows 7 QGIS 2.18.6 as well as 2.14.13. One person
reported that it failed for them on Windows 7 using QGIS 2.14.1.
from builtins import str
ImportError: No module named builtins
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 306, in
startPlugin
plugins[packageName] = package.classFactory(iface)
File "/home/user/.qgis2/python/plugins/latlontools/__init__.py", line 2,
in classFactory
from .latLonTools import LatLonTools
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/user/.qgis2/python/plugins/latlontools/latLonTools.py", line
9, in
from zoomToLatLon import ZoomToLatLon
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/user/.qgis2/python/plugins/latlontools/zoomToLatLon.py", line
11, in
import mgrs
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "/home/user/.qgis2/python/plugins/latlontools/mgrs.py", line 18, in
from builtins import str
File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 572, in
_import
mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named builtins
Does anyone know why this works with some QGIS installs and not others? Is
there a way to use 'builtins' and avoid it failing on some QGIS installs?
Thanks,
C Hamilton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170413/72ce83a8/attachment-0001.html>
More information about the Qgis-developer
mailing list