瀏覽代碼

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 年之前
父節點
當前提交
033ddd95c2
共有 1 個文件被更改,包括 4 次插入1 次删除
  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