1

I am a fresher in python.I had python 2.7 and 3.4.When I compile python 3.4 I get the following error but not in 2.7

File "C:\pyprojects\focus\site\focus2\flow.py", line 24, in _wrapper
    cls._meta = type("Meta", (), BaseFlowTile.Meta.__dict__)
TypeError: type() argument 3 must be dict, not mappingproxy

If I just use dict instead __dict__ then I get the following error

AttributeError: type object 'Meta' has no attribute 'dict'

Any help is highly appreciated.

Prithviraj Mitra
  • 11,002
  • 13
  • 58
  • 99

1 Answers1

1

Python 3.3 introduced a MappingProxyType, that basically allowed some optimizations.

You should be able to use a copy of this for both Python versions:

cls._meta = type("Meta", (), BaseFlowTile.Meta.__dict__.copy())
Gerrat
  • 28,863
  • 9
  • 73
  • 101
  • 1
    @PrithvirajMitra: It did take a bit to track down - it's always a pleasure to come across an interesting (uncommon) question like yours. – Gerrat Aug 05 '17 at 16:27