Skip to content

Commit b2a2ebb

Browse files
committed
Fix: Support Python 3 in shell script
Fixes #29. Thanks to @mpancia.
1 parent 328f6b2 commit b2a2ebb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

org-protocol-capture-html.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ EOF
4747
}
4848

4949
function urlencode {
50-
python -c "import sys, urllib; print urllib.quote(sys.stdin.read()[:-1], safe='')"
50+
python -c "
51+
try:
52+
from urllib import quote # Python 2
53+
except ImportError:
54+
from urllib.parse import quote # Python 3
55+
56+
import sys, urllib
57+
58+
print urllib.quote(sys.stdin.read()[:-1], safe='')"
5159
}
5260

5361
# * Args

0 commit comments

Comments
 (0)