Explorar el Código

Add support for python3 in liquid_tags/b64img.py

The following error occured when used with python3

ImportError: No module named 'urllib2'
Alexandre Norman hace 6 años
padre
commit
033ddd95c2
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      liquid_tags/b64img.py

+ 4 - 1
liquid_tags/b64img.py

@@ -24,7 +24,10 @@ Output
 """
 import re
 import base64
-import urllib2
+try:
+    import urllib.request as urllib2
+except ImportError:
+    import urllib2
 from .mdx_liquid_tags import LiquidTags
 import six