[issue37718] 2to3 exception handling

Xinmeng Xia report at bugs.python.org
Tue Jul 30 04:24:58 EDT 2019


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

we run the converted Python3 code, the following error will happen:
Traceback (most recent call last):
  File "/home/xxm/Desktop/instrument/datasetpy3/Labeled-LDA-Python/example.py", line 50, in <module>
    llda_model.save_model_to_dir(save_model_dir)
  File "/home/xxm/Desktop/instrument/datasetpy3/Labeled-LDA-Python/model/labeled_lda.py", line 697, in save_model_to_dir
    LldaModel._write_object_to_file(save_model_path, save_model.__dict__)
  File "/home/xxm/Desktop/instrument/datasetpy3/Labeled-LDA-Python/model/labeled_lda.py", line 650, in _write_object_to_file
    print(("%s\n\t%s" % (message, e.message)))
AttributeError: 'TypeError' object has no attribute 'message'

it seems that attributes change between Python2 and Python3. However 2to3 lack for this fix when dealing with exception fix.

----------
components: 2to3 (2.x to 3.x conversion tool)
files: labeled_lda.py
messages: 348720
nosy: xxm
priority: normal
severity: normal
status: open
title: 2to3  exception handling
versions: Python 3.7
Added file: https://bugs.python.org/file48516/labeled_lda.py

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


More information about the Python-bugs-list mailing list