4

I'm trying to export a project using qgis2leaf and this error appears:

An error has occurred while executing Python code:

Traceback (most recent call last):   File "C:/Users/grego/.qgis2/python/plugins\qgis2leaf\qgis2leafdialog.py", line 297, in export2leaf
    qgis2leaf_exec(self.outFileName, self.basemapName, self.basemapMeta, self.basemapAddress, self.width, self.height, self.extent, self.full_screen, self.layer_list, self.visible, self.opacity, self.encode2JSON,self.createcluster, self.webpage_name, self.webmap_head,self.webmap_subhead, self.legend,self.locate,self.address, self.precision, self.labels, self.labelshover, self.matchCRS, self.selected)   File "C:/Users/grego/.qgis2/python/plugins\qgis2leaf\qgis2leaf_exec.py", line 238, in qgis2leaf_exec
    in_raster = str(i.dataProvider().dataSourceUri()) UnicodeEncodeError: 'ascii' codec can't encode character u'\xba' in position 38: ordinal not in range(128)

Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

QGIS version: 2.8.7-Wien Wien, 8a47921

Python path: ['C:/Users/grego/.qgis2/python/plugins\\processing', 'C:/PROGRA~1/QGISWI~1/apps/qgis-ltr/./python', u'C:/Users/grego/.qgis2/python', u'C:/Users/grego/.qgis2/python/plugins', 'C:/PROGRA~1/QGISWI~1/apps/qgis-ltr/./python/plugins', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\matplotlib-1.3.1-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\nose-1.3.3-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\tornado-4.0.1-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\backports.ssl_match_hostname-3.4.0.2-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\certifi-14.05.14-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\bin\\python27.zip', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\DLLs', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\plat-win', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\lib-tk', 'C:\\PROGRA~1\\QGISWI~1\\bin', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\jinja2-2.7.2-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\markupsafe-0.23-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\pytz-2012j-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\Shapely-1.2.18-py2.7-win-amd64.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\six-1.10.0-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\xlrd-0.9.2-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\xlwt-0.7.5-py2.7.egg', u'C:/Users/grego/.qgis2//python', 'C:\\PROGRA~1\\QGISWI~1\\apps\\qgis-ltr\\python\\plugins\\fTools\\tools', 'C:\\Users\\grego\\.qgis2\\python\\plugins', 'C:/Users/grego/Desktop/Granada Qgs']

I have also tried using the qgis2web plugin but I get a similar thing appearing

Qgis2web error:

An error has occurred while executing Python code:

Traceback (most recent call last): File "C:/Users/grego/.qgis2/python/plugins\qgis2web\maindialog.py", line 139, in saveMap MainDialog.saveLeaf(self) File "C:/Users/grego/.qgis2/python/plugins\qgis2web\maindialog.py", line 324, in saveLeaf cluster, json, params, popup) File "C:/Users/grego/.qgis2/python/plugins\qgis2web\leafletWriter.py", line 99, in writeLeaflet exportRasterLayer(i, safeLayerName, dataPath) File "C:/Users/grego/.qgis2/python/plugins\qgis2web\leafletLayerScripts.py", line 52, in exportRasterLayer print "in_raster: " + in_raster UnicodeEncodeError: 'ascii' codec can't encode character u'\xba' in position 49: ordinal not in range(128)

Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

QGIS version: 2.8.7-Wien Wien, 8a47921

Python path: ['C:/Users/grego/.qgis2/python/plugins\processing', 'C:/PROGRA~1/QGISWI~1/apps/qgis-ltr/./python', u'C:/Users/grego/.qgis2/python', u'C:/Users/grego/.qgis2/python/plugins', 'C:/PROGRA~1/QGISWI~1/apps/qgis-ltr/./python/plugins', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\backports.ssl_match_hostname-3.4.0.2-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\bin\python27.zip', 'C:\PROGRA~1\QGISWI~1\apps\Python27\DLLs', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\plat-win', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\lib-tk', 'C:\PROGRA~1\QGISWI~1\bin', 'C:\PROGRA~1\QGISWI~1\apps\Python27', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\six-1.10.0-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg', 'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg', u'C:/Users/grego/.qgis2//python', 'C:\Users\grego\.qgis2\python\plugins', 'C:\PROGRA~1\QGISWI~1\apps\qgis-ltr\python\plugins\fTools\tools', 'C:/Users/grego/Desktop/Granada Qgs']

Map

Layers folder

Here is what appears in the python console:

There were errors executing the algorithm. Check the QGIS log to get more information Unable to execute algorithm Wrong parameter value: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified1457605619.1_prov.tif Raster type: 2 prov_raster: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified01457605622.76_prov.tif out_raster: C:\Users\grego\AppData\Local\Temp\qgis2web\qgis2web_1457605622.61\data\json_IGNPalomino1846modified0.png There were errors executing the algorithm. Check the QGIS log to get more information Unable to execute algorithm Wrong parameter value: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified01457605622.76_prov.tif Raster type: 2 prov_raster: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified01457605653.46_prov.tif out_raster: C:\Users\grego\AppData\Local\Temp\qgis2web\qgis2web_1457605653.24\data\json_IGNPalomino1846modified0.png There were errors executing the algorithm. Check the QGIS log to get more information Unable to execute algorithm Wrong parameter value: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified01457605653.46_prov.tif Raster type: 2 prov_raster: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified01457605671.88_prov.tif out_raster: C:\Users\grego\AppData\Local\Temp\qgis2web\qgis2web_1457605671.84\data\json_IGNPalomino1846modified0.png There were errors executing the algorithm. Check the QGIS log to get more information Unable to execute algorithm Wrong parameter value: c:\users\grego\appdata\local\temp\json_IGNPalomino1846modified01457605671.88_prov.tif

2 Answers 2

2

It seems that the data you qant to export uses special characters that can't be encoded into the ascii characters. If your dataset uses characters like 'ä', 'ö', 'ü', 'ß' and so on you could try to replace them through e.g. 'ae', 'oe', (...) as a workaround.

2
  • Could you paste the qgis2web error? qgis2leaf has today been deprecated, but I'd like to fix errors in qgis2web. Commented Mar 4, 2016 at 13:36
  • I've added the qgis2web error, what is the data I have to replace characters of? Sorry, I'm new at this...
    – Bandidot
    Commented Mar 5, 2016 at 0:11
1

If you are comfortable doing so, open C:/Users/grego/.qgis2/python/plugins\qgis2web\leafletLayerScripts.py in a text editor, and comment out line 52 by adding a # at the beginning of the line : #  print "in_raster: " + in_raster. Restart QGIS, and see what happens.

5
  • Thanks a lot for your help, it worked, but when the export is done I can't see my raster layer (an image of an old map) on top of the OSM layer, a tiny little square with a cross appears and that's all.
    – Bandidot
    Commented Mar 9, 2016 at 0:01
  • Interesting. Can you right-click the broken image in the browser, and choose Properties? See what path/URL the image has. Also look in the /layers folder of the output, and see if your raster is there. Commented Mar 9, 2016 at 7:18
  • I've put 2 images up on the post, It's in Spanish but I right click on the little box and no properties appear. Also there is a screenshot of the /layers folder with a java file.
    – Bandidot
    Commented Mar 9, 2016 at 21:19
  • The raster file has not been generated. Before starting qgis2web, can you open the python console in QGIS? Errors sometimes appear there. Commented Mar 10, 2016 at 7:13
  • There were no errors in python console when opening project, when I opened qgis2web and updated preview and then exported it all that I put on the post appears in the python console
    – Bandidot
    Commented Mar 10, 2016 at 10:29

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.