FIX: more Python 3 fixes for doc/gen_rst.py
FIX: more Python 3 fixes for doc/gen_rst.py

lesteve/sphinx-gallery,Eric89GXL/sphinx-gallery,sphinx-gallery/sphinx-gallery,lesteve/sphinx-gallery,Eric89GXL/sphinx-gallery,Titan-C/sphinx-gallery,Titan-C/sphinx-gallery,sphinx-gallery/sphinx-gallery