UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)
in not 39 can range byte position
2023-09-14 08:59:26 时间
问题分析:错误提示中的“ordinal not in range(128)”,意思是,字符不在128范围内,即说明不是普通的ASCII字符,超出处理能力了。
import sys print u'系统默认编码为',sys.getdefaultencoding() default_encoding = 'utf-8' #重新设置编码方式为uft-8 if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefaultencoding(default_encoding)
>>> ================================ RESTART ================================
>>>
系统默认编码为 ascii
>>>
问题1:
定位原因:
如下函数中print里面的中文所致,将print都注释掉后问题即可解决。
相关文章
- 【异常】 'ascii' codec can't decode byte 0xe8 in position 2: ordinal not in range(128)
- ORA_12514:TNS:listener does not currently know of service requested in connect descriptor
- [Typescript] Simplify iteration of custom data structures in TypeScript with iterators (backwards iteration with for ... of.. loop)
- [TypeScript] Using Interfaces to Describe Types in TypeScript
- Mybatis 传入List类型参数,报错:There is no getter for property named '__frch_item_0' in
- Unexpected error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd2 in position 69: ordinal not in range(128)-解决办法
- 【36】报错‘_1‘ was not declared in this scope return boost::python::make_function(boost::bind(&BiFunctio
- Column '表名.某列名' is invalid in the select list because it is not contained in either an aggregate f
- [FAQ] Member "address" not found or not visible after argument-dependent lookup in address payable.
- Field creation not permitted in partner development mode
- Useful code snippet to parse the key value pairs in URL
- filter operation implementation in SAP Gateway framework
- Method 'GET_ENTITYSET' not implemented in data provider class - correct case
- why FOR ALL ENTRIES is not considered at all in one order search
- Product ID Not in valid range
- why Material request downlaod get an empty BDOC in SMW01 - structure MGV_TLMNR
- can not watch variables in Eclipse
- Subqueries are not allowed in this context. Only scalar expressions are allowed.
- variable not availabe in Chrome debugger
- how does filter for list work in xml view
- Could not find an NgModule. Use the skip-import option to skip importing in
- 已解决UnicodeEncodeError: ‘utf-8‘ codec can‘t encode character ‘udf76‘ in position 32: surrogates not
- OUI-67076 : OracleHomeInventory was not able to create a lock file" in Unix
- How to Fix in R: duplicate ‘row.names’ are not allowed
- SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found."
- idea 配置 tomcat Warning: No artifacts configured “Web‘ Facet resources are not included in an artifac