alphapapa / org-protocol-capture-html

Capture HTML from the browser selection into Emacs as org-mode content
453 stars 39 forks source link

Add python 3 support to shell script #29

Closed mpancia closed 6 years ago

mpancia commented 6 years ago

Presently, the shell script doesn't work under Python 3 as a function of urllib changing the structure of its parse module.

https://github.com/alphapapa/org-protocol-capture-html/blob/328f6b22b3fb6620dcdfe53fdf0dca663bbac054/org-protocol-capture-html.sh#L50

This is an easy fix to make it compatible with both 2 and 3, either by throwing in a line like:

try:
    from urllib import quote  # Python 2.X
except ImportError:
    from urllib.parse import quote  # Python 3+

or using six to provide backward compatibility:

from six.moves.urllib.parse import quote
alphapapa commented 6 years ago

Ah, my distro still uses Python 2 by default, and I hadn't thought to test it on 3. Thanks very much for reporting. I'll fix this soon.