I've just installed the markdown preview plugin for gedit and I get the following error on the console when I try to activate it in the plugins tab:
Traceback (most recent call last): File
"/home/aarold/.local/share/gedit/plugins/markdown-preview/init.py",
line 25, in
import markdown ImportError: No module named 'markdown'(gedit:20735): libpeas-WARNING **: Error loading plugin
'markdown-preview
Note that this is not the same question as the other one about gedit since its solution does not work for me.
I've tried setting the Loader parameter in my /home/aarold/.local/share/gedit/plugins/markdown-preview.plugin
file to python
and python3
as well but none of them work. I tried reinstalling the plugin with all possible permutations of options and although it says install was succesful I always get this error. What could be the problem?
I've checked the .py
file and it seems that it cannot
import markdown
.
Do I need to install some additional python modules?
I've tried
pip install markdown
but although it
Successfully installed markdown
I still get the same error.
Best Answer
This plugin is written for Python 2, but since gedit 3.8, only Python 3 plugins are supported. So some small changes are required.
Modify the installer (
gedit-markdown.sh
) to install the python3 markdown module:This is a patch that you can apply on the existing file (or you can just copy the full modified version available here):
Run
./gedit-markdown.sh install
You should see python 3.4 instead of 2.7:
Change the plugin loader to python3
Replace
/home/aarold/.local/share/gedit/plugins/markdown-preview.plugin
with:Convert
/home/aarold/.local/share/gedit/plugins/markdown-preview/__init__.py
to python3:Run:
Finally open this file and edit line 86 (remove the binary mode,
"wb"
->"w"
):Activate the plugin in Gedit as you did.