-
Notifications
You must be signed in to change notification settings - Fork 647
Strange,Some characters make the terminal crash #76
Comments
I'm not sure if I understand your issue, but some special characters will interfere with terminal rendering regardless of language. Have you confirmed that CPython works correctly? |
It's ok with CPython ,I just want to output the source code of my py file , like "cat test.py" command with terminal ,if there are some special characters that will interfere with terminal rendering ,why CPython do it ok ,it makes me confused ,my english is terrible, I hope you can understand me |
Under Grumpy, sys.argv[0] is a compiled binary. As ns-cweber mentioned, when you try to print that data it turns into gibberish and confuses the terminal. I think you can accomplish what you want by replacing sys.argv[0] by |
yes,I tried, you are right, thank you. 👍 👍 👍 |
Miscellaneous additions to builtins
my test code for grumpy , test.py:
#--coding:utf-8--
#import urllib
import sys
print "++++++++++++++++++++++++++++++++++++"
#测试输出可执行程序自身
with open(sys.argv[0],'r') as f:
for line in f.readlines():
print line
print "++++++++++++++++++++++++++++++++++++"
#尝试输出Html解析的Header头信息
'''
url='http://baidu.com'
request=urllib.urlopen(url=url)
print request.info()
'''
Everthing seems to be ok before I run the target go exe file,When I run it in my terminal ,it just print out a lot of unreadable characters,and the history command is also unreadable,my OS is mac OS 10.12.2 . The output looks like below:
┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_610┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_62┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_63┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_64┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_65┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_66┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_67┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_68┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_69┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_70┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_71┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_72┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_73┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_74┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_75┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_76┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_77┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_79┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_80┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_81┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_82┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_83┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_84┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_85┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_86┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_87┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_88┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_89┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_90┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_91┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_92┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_93┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_94┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_95┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_96┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_97┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_98┤┼␋␌⎺␍␊.⎽├▒├␋␌├└⎻_99┤┼␋␌⎺␍␊.├⎺┤┼␋␌⎺␍␊/┤├°8.D␊␌⎺␍␊L▒⎽├R┤┼␊┤┼␋␌⎺␍␊/┤├°8.D␊␌⎺␍␊L▒⎽├R┤┼␊I┼S├⎼␋┼±┤┼␋␌⎺␍␊/┤├°8.D␊␌⎺␍␊R┤┼␊┤┼␋␌⎺␍␊/┤├°8.D␊␌⎺␍␊R┤┼␊┼S├⎼␋┼±┤┼␋␌⎺␍␊/┤├°8.E┼␌⎺␍␊R┤┼␊┤┼␋␌⎺␍␊/┤├°8.F┤┌┌R┤┼␊┤┼␋␌⎺␍␊/┤├°8.R┤┼␊C⎺┤┼├┤┼␋␌⎺␍␊┤├°8.R┤┼␊C⎺┤┼├I┼S├⎼␋┼±┤┼␋␌⎺␍␊/┤├°8.▒␌␌␊⎻├R▒┼±␊⎽┤┼␋␌⎺␍␊/┤├°8.°␋⎼⎽├_└▒␋┼
++++++++++++++++++++++++++++++++++++
B␊┼D␊⎼P▒┼␍␊M▒␌B⎺⎺┐-P⎼⎺:P│┐C⎺␍␊ B␊┼D␊⎼P▒┼$ 1;2␌1;2␌1;2␌1;2␌
-␉▒⎽: 1: ␌⎺└└▒┼␍ ┼⎺├ °⎺┤┼␍
-␉▒⎽: 2␌1: ␌⎺└└▒┼␍ ┼⎺├ °⎺┤┼␍
-␉▒⎽: 2␌1: ␌⎺└└▒┼␍ ┼⎺├ °⎺┤┼␍
-␉▒⎽: 2␌1: ␌⎺└└▒┼␍ ┼⎺├ °⎺┤┼␍
-␉▒⎽: 2␌: ␌⎺└└▒┼␍ ┼⎺├ °⎺┤┼␍
B␊┼D␊⎼P▒┼␍␊M▒␌B⎺⎺┐-P⎼⎺:P│┐C⎺␍␊ B␊┼D␊⎼P▒┼$
B␊┼D␊⎼P▒┼␍␊M▒␌B⎺⎺┐-P⎼⎺:P│┐C⎺␍␊ B␊┼D␊⎼P▒┼$
B␊┼D␊⎼P▒┼␍␊M▒␌B⎺⎺┐-P⎼⎺:P│┐C⎺␍␊ B␊┼D␊⎼P▒┼$
B␊┼D␊⎼P▒┼␍␊M▒␌B⎺⎺┐-P⎼⎺:P│┐C⎺␍␊ B␊┼D␊⎼P▒┼$
I thought it's caused by special characters ,but when I try to make it all ASCII,it's also output something strange ,but better .and this is a part of the output:
mp_604unicode.statictmp_605unicode.statictmp_606unicode.statictmp_607unicode.statictmp_608unicode.statictmp_609unicode.statictmp_61unicode.statictmp_610unicode.statictmp_62unicode.statictmp_63unicode.statictmp_64unicode.statictmp_65unicode.statictmp_66unicode.statictmp_67unicode.statictmp_68unicode.statictmp_69unicode.statictmp_70unicode.statictmp_71unicode.statictmp_72unicode.statictmp_73unicode.statictmp_74unicode.statictmp_75unicode.statictmp_76unicode.statictmp_77unicode.statictmp_79unicode.statictmp_80unicode.statictmp_81unicode.statictmp_82unicode.statictmp_83unicode.statictmp_84unicode.statictmp_85unicode.statictmp_86unicode.statictmp_87unicode.statictmp_88unicode.statictmp_89unicode.statictmp_90unicode.statictmp_91unicode.statictmp_92unicode.statictmp_93unicode.statictmp_94unicode.statictmp_95unicode.statictmp_96unicode.statictmp_97unicode.statictmp_98unicode.statictmp_99unicode.tounicode/utf8.DecodeLastRuneunicode/utf8.DecodeLastRuneInStringunicode/utf8.DecodeRuneunicode/utf8.DecodeRuneInStringunicode/utf8.EncodeRuneunicode/utf8.FullRuneunicode/utf8.RuneCountunicode/utf8.RuneCountInStringunicode/utf8.acceptRangesunicode/utf8.first_main
BenDerPandeMacBook-Pro:test BenDerPan$ 1;2c1;2c1;2c1;2c
The text was updated successfully, but these errors were encountered: