None type error | Sololearn: Learn to code for FREE!


None type error

I tried decorated function in python 3.7.3 shell By using code def decor (func): def wrap( ): Print ("=========") func( ) Print ("=========") return wrap def text( ): print ("Ganesh") Decorated=decor(text) Decorated( ) But this shows typeerror: 'nonetype' in my system Can you suggest me what to do

5/18/2019 8:30:44 AM

Ganesh Babu

2 Answers

New Answer


Thank you😁✌🏼


def decor(func): def wrap(): print("=========") func() print("=========") return wrap def text(): print("Ganesh") Decorated = decor(text) Decorated() Note the indentation level of "return wrap". In your code, the inner function wrap() is never called