python打包错误
在打包之前程序运行的很好,但是打包后就无法运行了
Traceback (most recent call last):
File "ionogram_measure.py", line 19, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 3: ordinal not in range(128)
19行的代码如下;
path0=os.getcwd().encode('utf-8')
如果把.encode('utf-8')去掉的话原程序就无法运行了,请问大侠们该怎么改啊
[解决办法]
当前目录有中文吧,貌似windows下应该:
path0=unicdoe(os.getcwd(), 'gbk') #unicode字串
想转utf-8的话:
path0=unicdoe(os.getcwd(), 'gbk').encode('utf-8')