[GIS] qgis2web python error message

errorpythonqgis2web

I've experienced at times that the qgis2web plugin does not work. I have received this python error message:

Ha ocurrido un error mientras se ejecutaba el código de Python:

Traceback (most recent call last):
  File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\qgis2web.py", line 51, in run
    dlg = MainDialog(self.iface)
  File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\maindialog.py", line 55, in __init__
    self.previewMap()
  File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\maindialog.py", line 97, in previewMap
    MainDialog.previewOL3(self)
  File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\maindialog.py", line 222, in previewOL3
    previewFile = writeOL(self.iface, layers, groups, popup, visible, json, cluster, labels, params, utils.tempFolder())
  File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\olwriter.py", line 53, in writeOL
    exportLayers(layers, folder, precision, optimize, usedFields)
  File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\utils.py", line 60, in exportLayers
    reducePrecision = re.compile(r"([0-9]+\.[0-9]{%s})([0-9]+)" % str(int(precision)))
ValueError: invalid literal for int() with base 10: ''


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


Versión de QGIS:
2.8.2-Wien Wien, 1b929ef

Ruta de Python: ['C:/PROGRA~1/QGISWI~1/apps/qgis/./python/plugins\\processing', 'C:/Users/u54202/.qgis2/python/plugins\\postgis_geoprocessing', 'C:\\Users\\u54202\\.qgis2\\python\\plugins\\GeoCoding\\libs', 'C:/PROGRA~1/QGISWI~1/apps/qgis/./python', u'C:/Users/u54202/.qgis2/python', u'C:/Users/u54202/.qgis2/python/plugins', 'C:/PROGRA~1/QGISWI~1/apps/qgis/./python/plugins', '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-win32.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\python_dateutil-2.2-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\pytz-2014.2-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-win32.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\six-1.6.1-py2.7.egg', 'C:\\PROGRA~1\\QGISWI~1\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', u'C:/Users/u54202/.qgis2//python', 'C:\\Users\\u54202\\.qgis2\\python\\plugins', 'C:\\PROGRA~1\\QGISWI~1\\apps\\qgis\\python\\plugins\\fTools\\tools', 'C:\\Users\\u54202\\.qgis2\\python\\plugins\\mmqgis/forms', 'C:\\Users\\u54202\\.qgis2\\python\\plugins']

The other day a solved this problem from the python console but today is not working:

from PyQt4.QtCore import QSettings
QSettings().remove("Extent")
QSettings().remove("Base layer")
QSettings().remove("Template")

Edit:

OK, It worked… but again I have the same problem: python error. But this time this syntax does not worked.

Why is this still happening?

Traceback (most recent call last): File
"C:/Users/u54202/.qgis2/python/plugins\qgis2web\qgis2web.py", line 51,
in run
dlg = MainDialog(self.iface) File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\maindialog.py", line
55, in init
self.previewMap() File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\maindialog.py", line
99, in previewMap
MainDialog.previewLeaflet(self) File "C:/Users/u54202/.qgis2/python/plugins\qgis2web\maindialog.py", line
229, in previewLeaflet
previewFile = writeLeaflet(self.iface, utils.tempFolder(), 500, 700, 1, layers, visible, "", cluster, "", "", "", labels, 0, 0, json,
params, popup) File
"C:/Users/u54202/.qgis2/python/plugins\qgis2web\leafletWriter.py",
line 203, in writeLeaflet
if str(field) == "icon_exp": UnicodeEncodeError: 'ascii' codec can't encode character u'\xed' in position 1: ordinal not in
range(128)

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

Versión de QGIS:
2.8.2-Wien Wien, 1b929ef

Ruta de Python:
['C:/PROGRA~1/QGISWI~1/apps/qgis/./python/plugins\processing',
'C:/Users/u54202/.qgis2/python/plugins\postgis_geoprocessing',
'C:\Users\u54202\.qgis2\python\plugins\GeoCoding\libs',
'C:/PROGRA~1/QGISWI~1/apps/qgis/./python',
u'C:/Users/u54202/.qgis2/python',
u'C:/Users/u54202/.qgis2/python/plugins',
'C:/PROGRA~1/QGISWI~1/apps/qgis/./python/plugins',
'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-win32.egg',
'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\python_dateutil-2.2-py2.7.egg',
'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\pytz-2014.2-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-win32.egg',
'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\six-1.6.1-py2.7.egg',
'C:\PROGRA~1\QGISWI~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode',
u'C:/Users/u54202/.qgis2//python',
'C:\Users\u54202\.qgis2\python\plugins',
'C:\PROGRA~1\QGISWI~1\apps\qgis\python\plugins\fTools\tools',
'C:\Users\u54202\.qgis2\python\plugins\mmqgis/forms']

Best Answer

Do the same in the console, but add qgis2web/ before each param name, eg:

QSettings().remove("qgis2web/Extent") QSettings().remove("qgis2web/Base layer") QSettings().remove("qgis2web/Template")

Since that error was caused by Precision, also try:

QSettings().remove("qgis2web/Precision")
Related Question