sk1418/myScripts

gbkUnzip filename UnicodeDecodeError

Closed this issue · 1 comments

There is a exception when I run ./gbkUnzip.py 测试.zip by python2.7 (notice: 测试.zip is download from qq email):

Traceback (most recent call last):
  File "./gbkUnzip.py", line 21, in <module>
    msg( u"unzip file: " + sys.argv[1])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128)

But this bug will disappear when I comment msg( u"unzip file: " + sys.argv[1]).
My system is OS X 10.9.2, terminal is iTerm, shell is zsh.

thank you for the testing. It was indeed a bug. I wrote and tested the main logic. later added some "nice" msg output without testing... It was fixed. also some error handling and output formatting were added.

Note if you don't have /usr/bin/python2, you should point the hashbang to your py2 file. It won't work with py3.