aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsmihica <smihica@gmail.com>2014-05-29 10:46:57 +0900
committersmihica <smihica@gmail.com>2014-05-29 10:46:57 +0900
commit892eff3be6671464189bd28a0e9de6d18e54701b (patch)
tree6c9272c9436788171406a84faccd981a6107eb85
parent76c139e635168f7a62d9063f412b19e71c0c6d3e (diff)
downloademmet-mode-892eff3be6671464189bd28a0e9de6d18e54701b.tar.lz
emmet-mode-892eff3be6671464189bd28a0e9de6d18e54701b.tar.xz
emmet-mode-892eff3be6671464189bd28a0e9de6d18e54701b.zip
To make tools/json2hash work in both python2.7 and 3.X
-rwxr-xr-xtools/json2hash14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/json2hash b/tools/json2hash
index afa50b2..ce7ee58 100755
--- a/tools/json2hash
+++ b/tools/json2hash
@@ -5,7 +5,14 @@ import sys
import os
import re
import argparse
-from cStringIO import StringIO
+
+python2 = sys.version_info[0] == 2
+python3 = sys.version_info[0] == 3
+
+if python2:
+ from cStringIO import StringIO
+if python3:
+ from io import StringIO
class ApplicationException(Exception):
pass
@@ -89,4 +96,7 @@ if __name__ == '__main__':
try:
main()
except ApplicationException as e:
- print >>sys.stderr, e.message
+ if python2:
+ print >> sys.stderr, e.message
+ elif python3:
+ print(e.meesage, file=sys.stderr)