AttributeError: 'function' object has no attribute 'func_name'
python2升级到python3报的错,
python3.0的函数没有func_name属性了,改成了__name__.
详见 官方文档:https://docs.python.org/3/whatsnew/3.0.html#miscellaneous-other-changes
-
The function attributes named
func_X
have been renamed to use the__X__
form, freeing up these names in the function attribute namespace for user-defined attributes. To wit,func_closure
,func_code
,func_defaults
,func_dict
,func_doc
,func_globals
,func_name
were renamed to__closure__
,__code__
,__defaults__
,__dict__
,__doc__
,__globals__
,__name__
, respectively. -
__nonzero__()
is now__bool__()
.