はじめに pythonに不慣れな方は、よくタイトルのようなエラーを見かけると思います。 実際には、このエラーはTypeErrorで、全体は以下のようなものです。 TypeError: メソッドの名前 missing 1 required positional argument: 'self' では、どうしてこのエラーは出るのでしょうか。そして、どうすれば良いのでしょうか。 簡単に解説していきます。なおpython3を使っていることを前提とします。 クラスをインスタンス化していない このエラーは、なんとなくエラーの文面だけ見ると、引数を渡してあげれば良いのかな? というような気がします。実際、引数を要求する関数を引数無しで呼び出すとほぼ同じエラーが出ます。 >>> def f(a): ... pass ... >>> f() Traceback (most recent call last)