2017-08-05 48 views
1

我在python.I更新鮮了Python 2.7版和3.4.When我編譯蟒蛇3.4我收到以下錯誤,但不是在2.7的Python 3.4型引起的功能錯誤

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 

如果我只是用字典來代替__dict__然後我得到以下錯誤

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

任何幫助,高度讚賞。

+0

非常抱歉,我讀了錯誤的方式! –

+0

我已經更改了標題和帖子,希望它有幫助。 –

回答

1

Python 3.3引入了一個MappingProxyType,基本上允許一些optimizations

您應該能夠使用這個副本都Python版本:

cls._meta = type("Meta",(), BaseFlowTile.Meta.__dict__.copy()) 
+0

輝煌。非常感謝。它現在在工作。 –

+1

@PrithvirajMitra:它確實需要一點點追蹤 - 碰到像你這樣有趣(不常見)的問題總是很高興。 – Gerrat