Capture and ignore AttributeError thrown in getpreferredencoding() in newer Python versions
Hi, I am using Python 3.7.3 and encountered the following exception at the end of running:
Exception ignored in: <function GPAWLogger.__del__ at 0x7f6c9835df28>
Traceback (most recent call last):
File "/home/jiegec/venv/lib/python3.7/site-packages/gpaw/io/logger.py", line 148, in del
File "/home/jiegec/venv/lib/python3.7/site-packages/gpaw/utilities/memory.py", line 46, in maxrss
File "/home/jiegec/venv/lib/python3.7/site-packages/gpaw/utilities/memory.py", line 20, in _VmB
File "/usr/lib/python3.7/_bootlocale.py", line 35, in getpreferredencoding
AttributeError: 'NoneType' object has no attribute 'utf8_mode'
A similar problem is reported at https://github.com/pyvisa/pyvisa/issues/416. The solution is to add AttributeError to the list of ignored exceptions.
Edited by Jiajie Chen