Browse Source

Add support for python3 in liquid_tags/b64img.py

The following error occured when used with python3

ImportError: No module named 'urllib2'
Alexandre Norman 6 years ago
parent
commit
033ddd95c2
1 changed files with 4 additions and 1 deletions
  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