-1

I have installed QGIS 2.8.9 in C:\OSGeo4W folder and change qgis-ltr-bin.bat last line with start "QGIS" /B "%OSGEO4W_ROOT%"\bin\surveykshak.exe --configpath "%OSGEO4W_ROOT%"\qgisini%*.

I changed this line for making QGIS on stick/USB drive. If I move the OSGEO4W folder to another system; it opens with the same settings.

I start the qgis and it gives me the following errors for first time only:

Couldn't load qgis.user.
Python support will be disabled.


Traceback (most recent call last):
  File "", line 1, in 
  File "C:/OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/OSGeo4W/apps/qgis-ltr/./python\qgis\user.py", line 47, in 
    import expressions
  File "C:/OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named expressions


Python version:
2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]

QGIS version:
2.0.0-XXXXXXX', exported

Python path:
['C:/OSGeo4W/apps/qgis-ltr/./python', u'C:\\OSGeo4W\\qgisini/python', u'C:\\OSGeo4W\\qgisini/python/plugins', 'C:/OSGeo4W/apps/qgis-ltr/./python/plugins', 'C:\\OSGeo4W\\bin\\python27.zip', 'C:\\OSGeo4W\\apps\\Python27\\DLLs', 'C:\\OSGeo4W\\apps\\Python27\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\plat-win', 'C:\\OSGeo4W\\apps\\Python27\\lib\\lib-tk', 'C:\\OSGeo4W\\bin', 'C:\\OSGeo4W\\apps\\Python27', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\jinja2-2.7.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win32.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\python_dateutil-2.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\pytz-2014.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win32.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', u'C:\\OSGeo4W\\qgisini/python']

The above error goes off when I open the qgis second time and a folder name qgisini created inside C:\OSGEO4W.

Now I had installed qgis2threejs via Plugin > Manage and install plugin. I am using a dem in UTM projection.

When I run the qgis2threejs it gives me following error:

An error has occurred while executing Python code:

Traceback (most recent call last):
  File "C:\OSGeo4W\qgisini/python/plugins\Qgis2threejs\qgis2threejsdialog.py", line 544, in run
    ret = exportToThreeJS(export_settings, self.iface.legendInterface(), self.objectTypeManager, self.progress)
  File "C:\OSGeo4W\qgisini/python/plugins\Qgis2threejs\export.py", line 238, in exportToThreeJS
    writer = ThreejsJSWriter(settings, objectTypeManager, bool(settings.exportMode == ExportSettings.PLAIN_MULTI_RES))
  File "C:\OSGeo4W\qgisini/python/plugins\Qgis2threejs\export.py", line 91, in __init__
    self.demProvider = settings.demProvider()
  File "C:\OSGeo4W\qgisini/python/plugins\Qgis2threejs\exportsettings.py", line 142, in demProvider
    return self.demProviderByLayerId(layerId)
  File "C:\OSGeo4W\qgisini/python/plugins\Qgis2threejs\exportsettings.py", line 209, in demProviderByLayerId
    return GDALDEMProvider(layer.source(), str(self.crs.toWkt()), source_wkt=str(layer.crs().toWkt()))    # use CRS set to the layer in QGIS
  File "C:\OSGeo4W\qgisini/python/plugins\Qgis2threejs\qgis2threejscore.py", line 114, in __init__
    self.ds.SetProjection(str(source_wkt))
AttributeError: 'NoneType' object has no attribute 'SetProjection'


Python version:
2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]


QGIS version:
2.0.0-XXXXX, exported

Python path: ['C:/OSGeo4W/apps/qgis-ltr/./python/plugins\\processing', 'C:/OSGeo4W/apps/qgis-ltr/./python', u'C:\\OSGeo4W\\qgisini/python', u'C:\\OSGeo4W\\qgisini/python/plugins', 'C:/OSGeo4W/apps/qgis-ltr/./python/plugins', 'C:\\OSGeo4W\\bin\\python27.zip', 'C:\\OSGeo4W\\apps\\Python27\\DLLs', 'C:\\OSGeo4W\\apps\\Python27\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\plat-win', 'C:\\OSGeo4W\\apps\\Python27\\lib\\lib-tk', 'C:\\OSGeo4W\\bin', 'C:\\OSGeo4W\\apps\\Python27', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\jinja2-2.7.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win32.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\python_dateutil-2.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\pytz-2014.2-py2.7.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win32.egg', 'C:\\OSGeo4W\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', u'C:\\OSGeo4W\\qgisini/python', 'C:\\OSGeo4W\\apps\\qgis-ltr\\python\\plugins\\fTools\\tools']

I already tried it by setting PYTHONHOME path and PATH variables in environment variables.

Is there any solution to this? How to remove this problem?

1 Answer 1

1

I have experienced the same error two or three times [1].

I could clear away the error by updating gdal-python package or reinstalling an older version of gdal-python package at those times.

As a stopgap adding the following line to qgis2threejscore.py line 31 should fix the issue.

....
try:
  from osgeo import gdal
except ImportError:
  import gdal

gdal.AllRegister()    # LINE TO ADD

from gdal2threejs import Raster
from geometry import Point
....

[1] https://github.com/minorua/Qgis2threejs/issues/63

1
  • This not an answer to the question.
    – Mapperz
    Commented Jul 28, 2016 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.