使用一次变量后,该变量转换为Nonetype

问题描述

   def find_files(file_path,file_names):

       def either(c):
             return '[%s%s]' % (c.lower(),c.upper()) if c.isalpha() else c

       yield from glob.iglob(file_path + '/**/' + ''.join(map(either,file_names)),recursive=True)
    ...


    sdm_files = find_files(local_Path,'QB*.sdm')
    self.table_widget.tabPCM.selectSDMfiles(sdm_files)
    ##### problem !!
    ##### after using variable "sdm_files"
    self.table_widget.tabPCM.Rx_cb_Group(sdm_files)
    ##### -> self.table_widget.tabPCM.Rx_cb_Group(sdm_files) this sdm_files variable converted to nonetype!!
    ##### -> TypeError: argument 1 has unexpected type 'nonetype'
    ...
    
    def selectSDMfiles(self,list):

    self.SDM_cb = QComboBox()
    self.SDM_cb.addItem("select SDM files")
    for index in list:
        if re.compile(r"(QB)(d*)(.*).(sdm)").search(index) is not None:
            s = re.compile(r"(QB)(d*)(.*).(sdm)").search(index)
            print(index[s.end() - 10:s.end() - 4])
            self.cb.addItem(index[s.end() - 10:s.end() - 4])

    self.SDM_cb.currentIndexChanged.connect(self.ActionSDM)
    self.dialogBox.addWidget(self.SDM_cb)

    return self.cb

    ...
    
    def Rx_cb_Group(self,list):
    self.str2 = 0
    self.Rx_cb = QComboBox()
    self.Rx_cb.addItems(["Rx level",'Rx SE out','Rx SE out 2nd','Rx SE in','Rx JBC in','DEC_PKT'])

    self.Rx_cb.currentIndexChanged.connect(self.Rx_cb_Act(list=list))
    self.dialogBox.addWidget(self.Rx_cb)
    return self.Rx_cb

我不明白为什么在使用一次变量后将变量转换为nonetype的原因。 TypeError:参数1具有意外的类型'nonetype'发生此错误。 请帮助我为什么会发生此错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)