Open XingMo opened 8 years ago
I am also having this problem.
I have the same issue with the same configuration: -Ubuntu 16.04 LTS -Gedit 3.18.3
I am facing the same situation ( Ubunut 16.04 , Gedit 3.18.3 )
There is no options added in the tools menu , and keyboard shortcuts ctrl+alt+m
and ctrl+alt+v
does nothing
These are the errors I found when opening gedit from command line
/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py:21: PyGIWarning: WebKit was imported without specifying a version first. Use gi.require_version('WebKit', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import Gdk, Gtk, Gedit, GObject, WebKit
Traceback (most recent call last):
File "/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py", line 113, in do_activate
self.addMarkdownPreviewTab()
File "/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in addMarkdownPreviewTab
panel.add_item(self.scrolledWindow, "MarkdownPreview", _("Markdown Preview"), image)
AttributeError: 'Stack' object has no attribute 'add_item'
Traceback (most recent call last):
File "/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
File "/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
File "/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
File "/home/adham/.local/share/gedit/plugins/markdown-preview/__init__.py", line 128, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Likewise. Different error in the console, but same manifestation: can't load the markdown preview plugin with gedit v3.18:
(gedit:17402): libpeas-WARNING **: Error importing plugin 'markdown-preview':
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 890, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/mhoovler/.local/share/gedit/plugins/markdown-preview/__init__.py", line 21, in <module>
from gi.repository import Gdk, Gtk, Gedit, GObject, WebKit
File "/usr/lib/python3/dist-packages/gi/importer.py", line 127, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name WebKit, introspection typelib not found
(gedit:17402): libpeas-WARNING **: Error loading plugin 'markdown-preview'
In the case of @mhoovler, missing dependencies are the main issue. As @XingMo mentioned you need webkitgtk
and python-markdown
(Those are the Arch names, check for your distribution), without these I get the same error as @mhoovler. Sort that out and I was able to at least enable the plugin, but it still didn't work.
The error posted by @babanesma is the real problem. There are a few outdated methods which are easily updated, but they are not the core of the problem - the plugin hasn't been updated for new versions of gedit which no longer uses the likes of a Gtk.UIManager
, despite what the (now outdated) documentation says. For this to work, the plugin needs updating.
For now the best solution may be to try a recently updated fork which incorporates these required changes, and is tested and working for the most part on the latest on Gedit 3.22, though it should work for other recent versions as well provided you have the right dependencies.
@babanesma Do you have repaired this bug? I have the same error. My gedit version is 3.22. Hope the plugin will update to solve the problem
I have a similar error. syntax highlighting works but when trying to enable the markdown-preview plug in the following error occurs:
(gedit:9607): libpeas-WARNING **: Error importing plugin 'markdown-preview':
Traceback (most recent call last):
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'markdown-preview'
(gedit:9607): libpeas-WARNING **: Error loading plugin 'markdown-preview'
python3-markdown and gir1.2-webkit-3.0 is installed on ubuntu 16.04
Same here. My gedit version is 3.22.
See my fork (including modifications by @nielsmde): darkdragon-001/gedit-markdown
@darkdragon-001 I seem to have all the dependencies, and the installation of your fork went successful. Now when I go to Plugins and tick the Markdown it is also successful, it stays ticked. Previously it just showed a red sign.
But I still don't see any Markdown Preview
entries under Tools
menu.
Traceback (most recent call last):
File "/home/name/.local/share/gedit/plugins/markdown-preview/__init__.py", line 425, in do_activate
self.app.set_accels_for_action("win.MarkdownPreview", [markdownShortcut])
AttributeError: '__main__.GeditAppX11' object has no attribute 'set_accels_for_action'
Traceback (most recent call last):
File "/home/name/.local/share/gedit/plugins/markdown-preview/__init__.py", line 120, in do_activate
self.addMarkdownPreviewTab()
File "/home/name/.local/share/gedit/plugins/markdown-preview/__init__.py", line 147, in addMarkdownPreviewTab
panel.add_titled(self.scrolledWindow, "MarkdownPreview", _("Markdown Preview"))
AttributeError: 'Panel' object has no attribute 'add_titled'
Traceback (most recent call last):
File "/home/name/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
(gedit:18152): Gtk-CRITICAL **: gtk_container_remove: assertion 'gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container)' failed
I'm on Ubuntu 14.04, Gedit 3.10.4.
@prkos Most of the issues described here refer to never versions of Ubuntu, gedit. I just confirmed that my fork workes within Ubuntu 18.04, gedit 3.28. You can try an older version, but I recommend you to update your system anyway.
@darkdragon-001 thank you. I'll have to dig out the time for the upgrade.
Hey @jpfleury , Why don't you merge the changes from @nielsmde and @darkdragon-001 ? It would be still not perfect, but otherwise the plugin is not usable anymore.
Tested on Ubuntu 18.04 with gedit 3.28.1
sudo apt install python3-markdown gir1.2-webkit-3.0
git clone https://github.com/darkdragon-001/gedit-markdown.git
cd gedit-markdown
./gedit-markdown.sh uninstall # remove old if exists
./gedit-markdown.sh install
Current drawbacks:
Highlights:
Side panel works by editing panel
in the config file (check README.md
for further information).
Oh, thank you for that hint. I missed the section concerning the configuration file. Would be better if this and the theme are configurable in a preferences dialog.
@jpfleury, @darkdragon-001
I am using gedit-3,28 under fedora 28. No chance to use the markdown plugin. I installed some missing dependencies, the last was
sudo dnf install python3-markdown
but now when you enable the plugin under Preferences/Plugins, you will end in
ValueError: Namespace WebKit not available
A bit googling shows that Webkit-3.0 is not supported any more after fedora 26. Is it possible to have a workaround?
@ekuester Do you have WebKit2-4.0 available in Fedora?
I started migration to WebKit2-4.0 in a separate branch. It runs without error on Ubuntu 18.10 with Webkit2-4.0. I commented out some signals which need to be reconnected though. I marked the corresponding passages with TODO
. Can someone help me with this?
@darkdragon-001 don't know if I can be of help. In the meantime I upgraded to fedora 29, now my gedit has version 3.30.2 ... To display markdown files I am using in the moment remarkable from jamiemcg, in issue 282 I describe the procedure to solve a problem with webkit. Maybe you can suck some honey of of it ... My system has installed webkit2gtk3 = 2.22.4-1.fc29 and webkitgtk4 = 2.22.4-1.fc29. Don't know if that is the right one for your purpose. If you mean it makes sense I could attempt a newly install of the markdown plugin.
@ekuester Can you please try if my fixed version works without any errors? The signals I commented out were mostly related to links and popups. So there might be issues here. But the rest should work.
@darkdragon-001 Installation via shell-script was successful, but ... activation of the plugin failed.
$ gedit &
[1] 8024
[kuestere@erichs-macbook gedit-markdown]$
(gedit:8024): libpeas-WARNING **: 11:12:14.486: Error importing plugin 'markdown-preview':
Traceback (most recent call last):
File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 22, in <module>
gi.require_version('WebKit', '3.0')
File "/usr/lib64/python3.7/site-packages/gi/__init__.py", line 129, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace WebKit not available
(gedit:8024): libpeas-WARNING **: 11:12:14.487: Error loading plugin 'markdown-preview'
OK, same as before ... Now I tried to change line 22 and 23 in init.py
gi.require_version('WebKit2', '4.0')
from gi.repository import Gdk, Gtk, Gedit, GObject, WebKit2, Gio
OK, ValueError disappeared, I can activate markdown-plugin under Plugins in Configuartion menu, in Tools menu I see update resp. toggle markdown preview, but greyed out. New error messages appear
$ gedit &
[1] 21026
Traceback (most recent call last):
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 109, in do_activate
self.htmlView = WebKit.WebView()
NameError: name 'WebKit' is not defined
Traceback (most recent call last):
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
Traceback (most recent call last):
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 139, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
It seems to me that actionGroup1 is not correctly defined. Dont know much about python, but in C++ such a variable must declared before using it ...
@ekuester Can you please check branch webkit2?
git clone -b webkit2 https://github.com/darkdragon-001/gedit-markdown.git
Command should read
git clone -b webkit2 https://github.com/darkdragon-001/gedit-markdown.git
I installed and then started gedit and looked at Configurations and activate markdown-plugin and returned to Tools menu and saw, that update resp. toggle markdown preview was clickable, and loaded a .md file and saw the markdown preview window BUT without content. Got error message
$ gedit &
[1] 6494
Traceback (most recent call last):
File "/home/kuestere/.local/share/gedit/plugins/markdown-preview/__init__.py", line 143, in do_update_state
self.actionGroup1.set_sensitive(self.window.get_active_document() != None)
AttributeError: 'MarkdownPreviewPlugin' object has no attribute 'actionGroup1'
sys:1: Warning: g_source_set_ready_time: assertion 'source->priv != NULL' failed
No doubt, the breakthrough is near ... In anticipating obedience ;-) I add the german translation file. markdown-preview.de.po.txt
Hmmm, that's weird. This error (similar to your tests before) appeared when it was not correctly initialized (usually with some other error appearing before).
Can you please try the following:
# Heading
)If this still doesn't work, can you please give me a list of (Fedora) packages one needs to install? I will try it in a docker container or virtual machine then...
Thanks a lot for the translation. I added them to the lastest (master
) version.
IT WORKS :-) At start it looks very promising because the markdown preview window was already open. I follow your instructions and saw "heading" in the preview. I loaded a .md file and after updating the preview all was fine. I saw no irritating error messages any more. PS: I corrected my .po file in an attack of hybris directly in your repository. Please look it, whether I did all right ...
Thanks for the confirmation and thanks for your translation work!
Nevertheless, I will wait with merging the webkit2
branch into master
until I find some time to rewrite the commented out actions...
@darkdragon-001 due to several typos the translation files do not work as expected. I add corrected versions below. init.py.txt markdown-preview.po.de.txt markdown-preview.po.fr.txt
@ekuester Can you please check if it works with the latest changes? Note that you have to rebuild the .mo
files!
@darkdragon-001 I loaded from your repository, I rebuild the .mo
files and installed anew. Afterwards it worked flawlessly (apart from the known limitations) with translation functional. Only the description for the plugin has to be adjusted (missing german translation).
BTW: Why do you disallow creating of issues in your repository?
attached:
markdown-preview.plugin.txt
It seems at the moment this is the biggest problem:
https://github.com/andresriancho/w3af/issues/13635
Any chance the plugin will be updated to use something that is still maintained?
@sixtyfive is this also true for WebKit2? Or is this version still maintained? If not, do you know any alternative?
For Ubuntu 18.04.3 LTS this is the solution:
git clone -b webkit2 git@github.com:darkdragon-001/gedit-markdown.git
./gedit-markdown.sh install
(if you have installed it before, you need to uninstall it first with ./gedit-markdown.sh uninstall
And... maybe this should be written in the install section.
I just released version 3 (preview) on https://github.com/darkdragon-001/gedit-markdown
WebKit2.WebView
to run in modern OSespymdown-extensions
is installed (pip3 install pymdown-extensions
)_GtkSourceView
stuff (color styles, language specs) (version 4 includes this out-of-the-box)Most of the issues in this repository should be dealt with in this release. I enabled issues in my repository.
Please test the new plugin and give me feedback. Pull requests are always welcome!
I have installed the
python3-markdown
and thegir1.2-webkit-3.0
, and I even wrote an example to make sure that. But the previewer still can't be loaded. Is it because I have both python2 and python3 on my computer? But the loader has been set topython3
in .plugin. Could anybody figure out the reason?-Ubuntu 16.04LTS -Gedit 3.18.3