當我試圖從我的類調用我的函數時,會引發此錯誤。 這是我的課:unbound方法MyFunction()必須用作爲第一個參數的Tools實例調用(沒有任何代替)
class Tools:
def PrintException(self):
# Do something
return 'ok'
View.py:
from tools import Tools
def err(request):
a = 10
b = 0
msg = ""
try:
print a/b
except Exception,ex:
c = Tools
return HttpResponse(Tools.PrintException())
我試圖尋找和發現這個錯誤的許多文章,但我覺得他們都不是我的問題!
unbound method must be called with instance as first argument (got nothing instead)
unbound method f() must be called with fibo_ instance as first argument (got classobj instance instead)