私は辞書でnew_variable = current_user.pub
を使用して、データベース内のパブの列からのデータを使用しようとしていますが、私はこのエラーAttributeError: 'NoneType' object has no attribute 'pub'
にこのについての任意のヘルプを取得していますが、ずっとここにpython辞書のcurrent_user変数を使用していますか?
を高く評価している私の完全なコード `
pins = {
4 : {'name' : 'Channel 1', 'board' : 'esp8266', 'topic' : '/4', 'state' : 'False'},
5 : {'name' : 'Channel 2', 'board' : 'esp8266', 'topic' : '/5', 'state' : 'False'}
}
variable = pins[4]['topic']
new_variable = current_user.pub
pins[4]['topic'] = new_variable
感謝ですあなた
ここで、「current_user」を定義していますか? – Dadep
'current_user'は定義されていないので、 'pub'属性を持たない' NoneType'です。それを使うために 'current_user'を作成します。 – depperm
お返事ありがとう 実際には' current_user'がパブからデータを呼び出すフラスコログイン列 –