datatyping icon indicating copy to clipboard operation
datatyping copied to clipboard

AttributeError: type object 'PrettyPrinter' has no attribute '_format_dict_items'

Open LaurensBosscher opened this issue 6 years ago • 6 comments

When running with Python 3.4

web_1        | Traceback (most recent call last):
web_1        |   File "/code/project_name/apps/students/util.py", line 227, in EDEXML_reader
web_1        |     pprint(groups_output)
web_1        |   File "/usr/local/lib/python3.4/site-packages/datatyping/printer.py", line 111, in pprint
web_1        |     with change_pprint_repr():
web_1        |   File "/usr/local/lib/python3.4/contextlib.py", line 59, in __enter__
web_1        |     return next(self.gen)
web_1        |   File "/usr/local/lib/python3.4/site-packages/datatyping/printer.py", line 101, in change_pprint_repr
web_1        |     old_format_dict_items = _pprint.PrettyPrinter._format_dict_items
web_1        | AttributeError: type object 'PrettyPrinter' has no attribute '_format_dict_items'

Looking at https://github.com/python/cpython/blob/3.4/Lib/pprint.py you can see that this was introduced in 3.5: https://github.com/python/cpython/blob/3.5/Lib/pprint.py.

Might be worth mentioning that only Python 3.5 and higher are supported!

LaurensBosscher avatar Nov 21 '17 16:11 LaurensBosscher