AttributeError: "object has no attribute" reported an error, could you tell me how to solve it?

in the following statement, QBDownloaderDayPrice inherits from QBDownloader, execution Times error AttributeError: "QBDownloaderDayPrice" object has no attribute" _ QBDownloader__flag_encoding". Could you tell me how to solve it?

import time
import datetime
import tushare as ts
import pandas as pd

class QBDownloader (object):

def __init__(self):
    self.__filename = ""
    self.__df_data = null
    self.__flag_encoding = 1

def saveto_csv(self):
    if self.__flag_encoding == 1:
        self.__df_data.to_csv(self.__filename, encoding="GBK")
    else:
        self.__df_data.to_csv(self.__filename)

class QBDownloaderDayPrice (QBDownloader):

def __init__(self):
    self.__filename = "QBdata\\DayPrice\\dp" + time.strftime("%Y%m%d", time.localtime()) + ".csv"
    self.__df_data = self.get_df_data()
    self.__flag_encoding = 1

def get_df_data(self):
    -sharpdataframe
    df_day_price = ts.get_today_all()
    return df_day_price

if name ="_ _ main__":

obj_dl = QBDownloaderDayPrice()
obj_dl.saveto_csv()
print u""
Mar.01,2021

take a closer look at error message and you'll find the problem.

the name of all attributes, if it is preceded by _ at the beginning of two underscores, the python interpreter will change its actual name to _ < Class Name > _ _ < Attributes Name >.

in the QBDownloader class, _ _ flag_encoding becomes _ QBDownloader__flag_encoding .

in the QBDownloaderDayPrice class, _ flag_encoding becomes _ QBDownloaderDayPrice__flag_encoding , and saveto_csv () the _ QBDownloader__flag_encoding accessed by the function itself is replaced by _ QBDownloaderDayPrice__flag_encoding . So you can't find _ QBDownloader__flag_encoding

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e922bd-4717d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e922bd-4717d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?