diff options
author | smihica <smihica@gmail.com> | 2014-05-29 10:46:57 +0900 |
---|---|---|
committer | smihica <smihica@gmail.com> | 2014-05-29 10:46:57 +0900 |
commit | 892eff3be6671464189bd28a0e9de6d18e54701b (patch) | |
tree | 6c9272c9436788171406a84faccd981a6107eb85 | |
parent | 76c139e635168f7a62d9063f412b19e71c0c6d3e (diff) | |
download | emmet-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-x | tools/json2hash | 14 |
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) |