]> git.phdru.name Git - dotfiles.git/blobdiff - bin/decode-URLs.py
Fix(bin/cp_recode_fname): Fix misspelled message
[dotfiles.git] / bin / decode-URLs.py
index 4d581938b9139df977b8bc2b7e0cae0b7fb4ecf0..ef04664342a87b7a5d5dc1c65045aa3399aee77d 100755 (executable)
@@ -1,12 +1,16 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-import sys, urllib
+try:
+    from urllib.parse import unquote
+except ImportError:
+    from urllib import unquote
+import sys
 
 while True:
    url = sys.stdin.readline()
    if not url:
       break
-   unqoted = urllib.unquote(url.strip())
+   unqoted = unquote(url.strip())
    if unqoted.startswith('file://'):
        unqoted = unqoted[len('file://'):]
    print(unqoted)