I use QGIS 2.18.3. I am trying to use qgis2web plugin to send my map to the web (very simple map: 1 layer polygons, 1 layer points, 1 tile) but I get the following error:

Traceback (most recent call last):
File "C:/Users/pc/.qgis2/python/plugins\qgis2web\maindialog.py", line 162, in previewMap
File "C:/Users/pc/.qgis2/python/plugins\qgis2web\maindialog.py", line 369, in previewOL3
cluster, params, utils.tempFolder())
File "C:/Users/pc/.qgis2/python/plugins\qgis2web\olwriter.py", line 302, in writeOL
print traceback.format_exc()
IOError: [Errno 9] Bad file descriptor
  • If I try leaflet I get a different error: AttributeError: 'NoneType' object has no attribute 'nodeType' – Jacopo Feb 15 '17 at 22:21
  • Which version of qgis2web are you using? – wondim Feb 16 '17 at 9:18
  • Before starting qgis2web, can you open the QGIS Python console? That should get rid of the error, and replace it with a meaningful one which should appear in that console. – Tom Chadwin Feb 16 '17 at 12:15
  • I am using qgis2web 2.6.0 – Jacopo Feb 16 '17 at 13:38
  • I opened the python console before running qgis2web and I report here the error appearing in console – Jacopo Feb 16 '17 at 13:41

There are a number of things which are stopping this from working in qgis2web:

  1. The layer group - these are not well supported in qgis2web, so I would remove all layer groups (the one in this project does not seem necessary)

  2. Quick Map Services layers are not supported

Issues 1 and 2 can be solved by removing the layer group and QMS layers, and instead adding a Tile Server (XYZ) layer.

  1. Inverted polygon renderers are not supported - there is no workaround for this at this time

  2. The labelling expression contains functions which are not yet supported, though this is an area which is under active development, so progress might be made on this soon.

In summary, you have used various features of QGIS which qgis2web simply does not support. Sorry not to have better news.


This is a bug in the qgis2web code relating to error reporting. It is meant to print meaningful diagnostic information for the issue which has occurred. However, in some situations (specific operating systems, QGIS Python console not open) it instead results in the error reported above. This is completely unhelpful, since it replaces the meaningful error message with a message relating to the process of gathering the error message.

I've just committed a change to the code which will solve this problem. Error messages will now be logged to a dedicated qgis2web error log, rather than printed out to the QGIS Python console. Please download the master branch from Github (https://github.com/tomchadwin/qgis2web) and overwrite your qgis2web installation. A new version of qgis2web will be released soon which includes this fix.

When an error occurs, open the QGIS Log Messages Panel (in QGIS, View > Panels > Log Messages Panel), and click on the qgis2web tab. You can then report the error you find there, which should be specific to the issue you've encountered.

  • Thanks Tom. What I should do is to delete the qgis2web folder I have in Users/.qgis2/python/plugins (there is another one with same name but containing only two html templates in users/.qgis2), unzip there the master version of github.com/tomchadwin/qgis2web? I tried like that, but when I select the qgis2web-master in "manage and install plugin" it tells me that that plugin is corrupted. – Jacopo Feb 16 '17 at 13:58
  • The zip you download from Github will contain a single folder called qgis2web-master. Copy the contents of that folder into Users/.qgis2/python/plugins/qgis2web/. In other words, the folder in plugins must be called qgis2web, not qgis2web-master, and the plugin files must be in that qgis2web folder, not in a subfolder. I hope that makes sense. You will also need to restart QGIS to detect the new version. – Tom Chadwin Feb 16 '17 at 14:05
  • Perfect sense. Thanks a lot. Just one more thing. When I copy the content of qgis2web-master inside Users/.qgis2/python/pligins/qgis2web then almost everything is replaced but there are few files that are not because there is not files with same names in qgis2web-master, for example resources_rc.pyc (there is resources_rc.py but not resources_rc.pyc). Shall I first delete everything and then paste the content or it does not matter? – Jacopo Feb 16 '17 at 14:21
  • When the plugin is loaded by QGIS, QGIS's Python compiler compiles the Python .py files into compiled .pyc files which QGIS then runs. That's why the .pyc files are not on Github. You can do either of the things you described - delete everything, or just overwrite and don't worry about the .pyc files - they will be overwritten when you restart QGIS. – Tom Chadwin Feb 16 '17 at 14:26
  • Thanks. I did it. Now, as you suggested I enabled the log message panel and the error I found in Python log after running qgis2web is: TypeError: 'int' object is not iterable – Jacopo Feb 16 '17 at 17:09

Sometimes "print" raise IOError: [Errno 9] Bad file descriptor. Just try open python console in qgis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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