alphapapa/org-protocol-capture-html

Add python 3 support to shell script

Closed this issue · 1 comments

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

python -c "import sys, urllib; print urllib.quote(sys.stdin.read()[:-1], safe='')"

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

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.