[New-bugs-announce] [issue37715] 2to3 set default encoding

Xinmeng Xia report at bugs.python.org
Tue Jul 30 02:11:45 EDT 2019


New submission from Xinmeng Xia <xiaxm at smail.nju.edu.cn>:

There is a bug in lib2to3. When dealing with this project "struts-scan" by 2to3,the following bug will show up. 
Traceback (most recent call last):
  File "/home/xxm/Desktop/instrument/datasetpy3/struts-scan/struts-scan.py", line 18, in <module>
    sys.setdefaultencoding('utf-8')
AttributeError: module 'sys' has no attribute 'setdefaultencoding'

"sys.setdefaultencoding('utf-8')" is not dealt with by lib2to3. In Python3, there is no such API "setdefaultencoding" for "sys". 

A possible solution to improve 2to3 is to delete this line     "sys.setdefaultencoding('utf-8')" when converting Python2 projects

----------
components: 2to3 (2.x to 3.x conversion tool)
files: struts-scan.py
messages: 348716
nosy: xxm
priority: normal
severity: normal
status: open
title: 2to3 set default encoding
type: compile error
versions: Python 3.7
Added file: https://bugs.python.org/file48514/struts-scan.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37715>
_______________________________________


More information about the New-bugs-announce mailing list